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();
}
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 +'")");