Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 6345cf5

Browse files
author
daserge
committed
Fixes insertId usage in the sample to work in Chrome
This closes #32
1 parent 519b8a5 commit 6345cf5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/js/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ var app = {
1616
},
1717

1818
onSuccess: function (transaction, resultSet) {
19+
var insertId = null;
1920
console.log('Operation completed successfully');
20-
document.getElementById("lblTxInfo").innerHTML = 'RowsAffected: ' + resultSet.rowsAffected + '; InsertId: ' + resultSet.insertId;
21+
try {
22+
insertId = resultSet.insertId;
23+
} catch (ex) {
24+
// If the statement did not insert a row, then the attribute must instead raise an INVALID_ACCESS_ERR exception.
25+
// http://www.w3.org/TR/webdatabase/#database-query-results
26+
console.log('insertId: null');
27+
}
28+
document.getElementById("lblTxInfo").innerHTML = 'RowsAffected: ' + resultSet.rowsAffected + '; InsertId: ' + insertId;
2129
app.getAllTodoItems(transaction);
2230
},
2331

0 commit comments

Comments
 (0)