Phonegap Error Processing Sql 5
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the sqlite error code 5 workings and policies of this site About Us Learn more about
Error Processing Sql Undefined Phonegap
Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions error processing sql 0 phonegap Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other.
Error Processing Sql Undefined Cordova
Join them; it only takes a minute: Sign up SQLite Cordova - Error processing SQL: 5 up vote 1 down vote favorite 1 var db = window.openDatabase("Database", "1.0", "userData", 200000); console.log(db); db.transaction(populateDB, errorCB, successCB); function populateDB(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS USER (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, api_key TEXT NOT NULL, username TEXT NOT NULL)'); tx.executeSql('INSERT object sql error INTO USER (api_key, username) VALUES ( "asd", row")'); } function errorCB(err) { console.log("Error processing SQL: "+err.message); } function successCB() { console.log("success!"); } First SQL statements executes, but then the second one returns: could not prepare statement (1 unrecognized token: "")") //with error code 5 . Any ideas why? I am following the PhoneGap Docs at here sql sqlite cordova share|improve this question edited Aug 7 '14 at 11:34 asked Aug 7 '14 at 11:21 Claudiu S 70321327 Why are you logging the code number instead of the message? –CL. Aug 7 '14 at 11:23 @CL: Edited now. Error code seems more helpful than error itself :P –Claudiu S Aug 7 '14 at 11:25 I did not ask for err itself. –CL. Aug 7 '14 at 11:28 ah! changing to err.message gives could not prepare statement (1 unrecognized token: "")") –Claudiu S Aug 7 '14 at 11:30 add a comment| 1 Answer 1 active oldest votes up vote 3 down vote accepted You forge the opening quote of
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. http://stackoverflow.com/questions/25181227/sqlite-cordova-error-processing-sql-5 Join them; it only takes a minute: Sign up SQLITE Query Error on Phonegap SYNTAX_ERR up vote 4 down vote favorite I'm trying to create a db using SQLITE on phone gap[cordova 1.7.0] with IOS5. When I increase the number of data, the query fails & outputs an error. I followed the storage API steps, so I don't http://stackoverflow.com/questions/10538388/sqlite-query-error-on-phonegap-syntax-err know what is the problem. I tried to increase the database size, but it still didn't work. This is my code: function populateDB(tx) { tx.executeSql('DROP TABLE IF EXISTS SESSION'); tx.executeSql('CREATE TABLE IF NOT EXISTS SESSION (id unique, dayId, subject, Seq)'); tx.executeSql('INSERT INTO SESSION (id unique, dayId, subject, Seq) VALUES (1, 4, "English", 1)'); tx.executeSql('INSERT INTO SESSION (id unique, dayId, subject, Seq) VALUES (2, 1, "Math", 3)'); tx.executeSql('INSERT INTO SESSION (id unique, dayId, subject, Seq) VALUES (3, 2, "Social", 5)'); tx.executeSql('INSERT INTO SESSION (id unique, dayId, subject, Seq) VALUES (4, 6, "Science", 7)'); console.log('finished filling'); } function queryDB(tx) { tx.executeSql('SELECT * FROM SESSION', [], querySuccess, errorCB); //It doesn't come here } function querySuccess(tx, results) { // Doesn't come here too var len = results.rows.length; console.log("DEMO table: " + len + " rows found."); for (var i=0; i here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and http://stackoverflow.com/questions/13689006/how-to-show-useful-error-messages-from-a-database-error-callback-in-phonegap policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only error processing takes a minute: Sign up How to show useful error messages from a database error callback in Phonegap? up vote 6 down vote favorite 2 Using Phonegap you can set a function to be called back if the whole database transaction or the individual SQL statement errors. I'd like to know how to get more information about the error. I have error processing sql one generic error-handling function, and lots of different SELECTs or INSERTs that may trigger it. How can I tell which one was at fault? It is not always obvious from the error message. My code so far is... function get_rows(tx) { tx.executeSql("SELECT * FROM Blah", [], lovely_success, statement_error); } function add_row(tx) { tx.executeSql("INSERT INTO Blah (1, 2, 3)", [], carry_on, statement_error); } function statement_error(tx, error) { alert(error.code + ' / ' + error.message); } From various examples I see the error callback will be passed a transaction object and an error object. I read that .code can have the following values: UNKNOWN_ERR = 0 DATABASE_ERR = 1 VERSION_ERR = 2 TOO_LARGE_ERR = 3 QUOTA_ERR = 4 SYNTAX_ERR = 5 CONSTRAINT_ERR = 6 TIMEOUT_ERR = 7 Are there any other properties/methods of the error object? What are the properties/methods of the transaction object at this point? I can't seem to find a good online reference for this. Certainly not on the Phonegap website! database cordova error-handling share|improve this question asked Dec 3 '12 at 17:58 Magnus Smith 2,83142748 add a comment| 2