I am trying to use a SQLite plugin for PhoneGap for Windows Phone 8. I've found 2 or 3 different plugins (maybe all of them are based from the same base) and all give me an error when the applicattion is executed. The plugin I'm using is from here: https://github.com/marcucio/Cordova-WP-SqlitePlugin
I am including also the dll. I'm using PhoneGap 3.3.
When I execute the application, the plugin is loaded (it seems is loades correctly) and some operations are done correctly (some CREATE and some INSERT are performed) but at a given moment the Visual Studio gives me this error infinite times:
An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.Security.SecurityException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.ni.dll
I've tried other similar plugins and the error still appears.
The other threads in stackoverflow related to this problem didn't solve the problem. The application always crashes in an IsolatedStorage operation.
Anyone had the same problem and could solve it? If I don't perform any INSERT operation the plugin doesn't crash.
Thank you.
I had the same problem using Community.CsharpSqlite.WinPhone
, it's possible that we have the same issue.
This happened when I did an INSERT OR REPLACE
or INSERT OR IGNORE
with a table which primary key was TEXT and had NOT NULL
constraint. If the primary key is INTEGER
and AUTOINCREMENT
, it works fine.
For example:
CREATE TABLE table1 (
tableid TEXT NOT NULL,
value TEXT NOT NULL,
PRIMARY KEY(tableid)
);
INSERT or REPLACE INTO table1 (tableid, value) VALUES ("id1","test");
If your id column has NOT NULL
constraint, SQLite will return a System.Security.SecurityException
. Try to remove this constraint:
CREATE TABLE table1 (
tableid TEXT,
value TEXT NOT NULL,
PRIMARY KEY(tableid)
);
It's a bug, in other platforms (Android, iOS, etc) the table can have a NOT NULL
constraint and it works fine.