Claudiu S
Claudiu S

Reputation: 1627

SQLite Cordova - Error processing SQL: 5

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 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

Upvotes: 2

Views: 4503

Answers (1)

CL.
CL.

Reputation: 180101

You forge the opening quote of the row string.

Upvotes: 3

Related Questions