Database code=3 error sqLite
Hi,
here's my problem :
var row = db.execute('SELECT nom,prenom FROM pcUser where nummobile=? and motdepasse=?',email,pass);
then I do :
value:row.field(0),
It works perfectly on the IPhone simulator, BUT does not on my IPhone 3G and returns the following error :
"invalid SQL statement.Error domain=com.plausiblelabs.pl database code=3 Userinfo=0x4b2b0e0 "an error occured parsing the provided SQL Statement." in - [TiDatabaseProxy execute:]
(TiDatabseProxy.m:132) at mesgroupes.js(line4)"
Anybody's got an idea ?
Thanks
3 Answers
-
According to the SQLite docs (http://www.sqlite.org/c3ref/c_abort.html), an error 3 is a "Access Permission Denied" error…
Have you created the database in your setup code? (Can't think of any other problem)
cheers
jc -
I've created the database with "sqLite manager" (an addon on firefox)
Am I suppose to create the db in the setup code ?
thanks
-
I ususally do the following: I have a function in my code that creates the database like this:
var db_name = "my_db_name"; function initialize_db() { var db = Titanium.Database.open(db_name); Titanium.API.log("debug", "initialize_db"); db.execute('CREATE TABLE IF NOT EXISTS items (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, '+ 'name STRING NOT NULL )'); //db.close(); } // call the init code in app.js initalize_db();
I have never worked with a pre-existing database
cheers
jc