Closed davidebaltieri31 closed 10 years ago
I'm not really sure if nested transactions are handled or tested. Does this work in websql?
A couple of things.
tx.executeSql("DROP TABLE IF EXISTS DEMO ", [], function() {
tx.executeSql("CREATE TABLE IF NOT EXISTS DEMO ...", [], function() {
...
});
});
I agree, you need to remember javascript is async so you will need to nest the calls to know for sure that the previous call is executed.
I'm going to close this issue
Are nested transactions supported?
Something like this: db.transaction( function(tx) { tx.executeSql('DROP TABLE DEMO'); tx.executeSql( 'CREATE TABLE IF NOT EXISTS DEMO (id INTEGER PRIMARY KEY, data TEXT)', [], function(tx,results) { console.log('populate1'); tx.executeSql( 'INSERT INTO DEMO (id, data) VALUES (?, ?)',[1,'First row'], function(tx,results) { console.log('populate2'); tx.executeSql( 'INSERT INTO DEMO (id, data) VALUES (?, ?)', [2,'Second row'], function(tx,results) ... ...
I tried it and the INSERTs are not working. Debugged the code and after the CREATE TABLE transaction nothing is sent to executeSqlBatch.