marcucio / Cordova-WP-SqlitePlugin

14 stars 20 forks source link

Possible DROP TABLE solution #22

Open nonplus opened 10 years ago

nonplus commented 10 years ago

FYI, I've been working on WindowsRT support for WebSQL (using the amalgamated C source rather than CsharpSqlight) and executing multiple DROP TABLE statements within a transaction was failing with SQLITE_ERROR.

It turned out that the issue was cause by my code not initializing the sqlite3_temp_directory. The second DROP TABLE required SQLite to create a temporary file and it couldn't do so since sqlite3_temp_directory was NULL.

It's possible this is the cause of the problem you're facing in your plugin.

http://www.sqlite.org/c3ref/temp_directory.html

marcucio commented 10 years ago

great thanks, I will check it out when I get a sec

d-ross commented 9 years ago

I was having a bunch of other problems with inserts containing large amounts of data not working (also using the USE_WP8_NATIVE_SQLITE flag) and it turned out setting the SQL temp dir also solved that problem.

Right now I just do this right after the SQLiteConnection is created:

string tempPath = ApplicationData.Current.LocalFolder.Path; var cmd = this.db.CreateCommand("PRAGMA temp_store_directory = '"+tempPath+"';"); int rowsAffected = cmd.ExecuteNonQuery();