Yes, you can use transaction in Async mode but it will not be as easy as sync.
On Async, this is what you need to do: - Before you call begin(), your sqlStatement needs to listen for SQLEvent.BEGIN. - When SQLEvent.BEGIN is thrown, your sqlStatement needs to listen for SQLEvent.RESULT for your insertion query. Your insertion query can only be executed one at a time, meaning after a SQLEvent.Result is thrown. - Finally, your sqlStatement needs to listen for SQLEvent.COMMIT before you call commit(). And that's your transaction in Async mode. Btw, I didn't add "listening to SQLEventError" on the instruction because I am just too lazy to type it :) Since it's a pain to do this big-Async-code everytime you are going to do a transaction, my suggestion is make a class that dedicates for transaction operation. That's the easy part. Right now, I am in the middle of confusion on how to handle multiple-transaction for insertion. The insertion just failed on that scenario. I will write this on another thread :) --- In flexcoders@yahoogroups.com, George <ya...@...> wrote: > > Hi there, > > I check lots of documents and google examples on SQLite transaction, > most of them in sync mode that not fit what we need exactly. > > What I need is during the transaction, I want to insert a list of items > into a table. I reuse a single insert statement prepared. So what I did: > > connection.begin(SQLTransactionLockType.IMMEDIATE); > for(var i:int=0; i<items.length; i++) > { > // execute an insert statement instance with item parameters > ... > } > connection.commit(); > > The problem I found, in async mode, after the statement instance is > executed, it didn't finish its own task, so its status is 'executing', > that means next item is not possible to be continue. > > I guess in this case I cannot use transaction? > > Thanks, > George >