Skip to content Skip to sidebar Skip to footer

Html 5 Sqlite: Multiple Inserts In One Transaction

Is it possible to do something like this: begin; insert into some_table (some_col, another_col) values ('a', 'b'); insert into some_table (some_col, another_col) values ('c

Solution 1:

Here is sample code of how you do it. I tested in on recent versions of safari and chrome in macos, ios and android.

var db = openDatabase('dbname', '1.0', 'db description', 1024 * 1024);
db.transaction(function (tx) {
    tx.executeSql("insert into some_table (some_col, another_col) values ('a', 'b');");
    tx.executeSql("insert into some_table (some_col, another_col) values ('c', 'd');");
    ...
},

)

Post a Comment for "Html 5 Sqlite: Multiple Inserts In One Transaction"