Reputation: 121
I have a method that constructs an insert query but crashes due to string being malformed. What is that i am missing?
saveWorkDocket : function(onSuccessCallback, onErrorCallback, options) {
var db = Ti.Database.open('xyz');
db.execute("INSERT INTO tbl_temp (tableName, data, id, dateCreated) VALUES ('" + options.tableName + "','" + options.data + "','" + options.workdocketID + "','" + options.dateCreated +'");
db.close();
}
Upvotes: 0
Views: 36
Reputation: 7023
You missing to close double " in the end of the query and close the function brackets, try this:
var db = Ti.Database.open('xyz');
db.execute("INSERT INTO tbl_temp (tableName, data, id, dateCreated) VALUES ('" + options.tableName + "','" + options.data + "','" + options.workdocketID + "','" + options.dateCreated +'")");
Upvotes: 2