On Fri, Jul 24, 2009 at 4:45 PM, Nikunj R. Mehta<nikunj.me...@oracle.com> wrote: >> No. The transaction is not closed on GC, it is closed when the last >> statement that is part of the transaction completes. So holding a >> reference to the tx variable does nothing one way or the other. The >> only way to hang the transaction open would be to execute statements >> over and over. > > A transaction is not complete until I either commit or rollback the > transaction, which I can choose to do as late as I want to, e.g., at > window.onclose. Therefore locks on the database will not be released for as > long as the application wants to hold on to the transaction.
I don't think that this is true, at least in the Database interface: http://dev.w3.org/html5/webdatabase/#asynchronous-database-api There is no explicit commit() method. The commit happens implicitly after all queued statements have been executed successfully. It does appear that it is possible to hold a transaction open all day with the DatabaseSync interface (http://dev.w3.org/html5/webdatabase/#databasesync). Specifically the SQLTransactionSync method has commit/rollback methods. The DatabaseSync interface was added after I worked on this, so I can't say why it doesn't use callbacks. In any case, I was talking about the async flavor which is what my example code referred to. Do you agree it is not possible to hang transactions open from Database (http://dev.w3.org/html5/webdatabase/#database)? If not, what am I missing? - a