Below is a snippet of JavaScript code I am using:
function insertIntoTable(title, text, sketchFileName, categoryId)
{
var db = window.openDatabase('xxx', '1.0', 'xxx database', 5*1024*1024);
db.transaction(
function (tx) {
if (sketchFileName == '')
{
tx.executeSql('INSERT INTO TableXXX (title, content, created, categoryID) VALUES (?, ?, ?, ?)',
[title, text, Date.now(), categoryId],
function (transaction, resultSet) {
if (resultSet.rowsAffected) {
myNameSpace.returnedId = resultSet.insertId;
}
}, handleSQLError);
}
}, handleSQLError);
);
}
Currently, I am using a global variable, myNameSpace.returnedId
, to capture the insertId.
Is there a way to modify the function insertIntoTable
to include a new parameter that points to myNameSpace.returnedId
?