Did you find a way to make AJAX calls during a transaction? I have not finished reading the entire specification, but so far it is like once your SQLTransactionCallback or SQLTransactionSyncCallback back, you cannot add more things to the transaction - or can you? Maybe from a results callback?
Edit: Now, when I look again, the spec (which contains far fewer errors than the Apple document you linked to but not so easy to read) says this :
- If the [
executeSql ] method was not called during SQLTransactionCallback , SQLStatementCallback or SQLStatementErrorCallback , then raise the INVALID_STATE_ERR exception.
So I think that means that there is no way to do this.
Further editing: No, wait! While the SQLStatementCallback takes some time to receive the call, you can wait for select 3 + 4 repeatedly, repeating each time from the callback of the previous select 3 + 4 , until your AJAX call sets the flag somewhere, has the necessary data. This is scary programming (it will take a lot of processor for no good reason, it may block tasks with lower priority, such as redrawing the page), but I think this is probably the only way to keep the transaction open for an arbitrary period of time. Too bad, you cannot select 3 + 4, sleep(1) in SQLite.
In general, SQLite (the primary storage engine here) rolls back transactions in progress. I have not tested the page reload error case you are asking about yet. I would be very surprised if this were done.
By the way, many thanks for posting this question. I tried to figure out how to cancel a transaction, even if it was carefully documented in the original specification.
Kragen javier sitaker
source share