[whatwg] SQL API and closeTransaction()
beidson at apple.com
Thu Oct 4 19:06:55 PDT 2007
I know there has been a little discussion in the last few weeks on
this point, but I don't know that anything was decided and the spec is
certainly still ambiguous.
From the definition of the Database object -
"void closeTransaction(); // only needed as part of error recovery"
Then later described -
"The closeTransaction() method may be called while in a callback
called by the executeSql() method. When the method is invoked, it must
clear any active thread-global transaction..."
This is too vague.
The implication in the Database object spec is that closeTransaction()
is only meant for error recovery, implying that an explicit call to
closeTransaction() will always rollback the active thread-global
But the description of the method says closeTransaction() will "clear"
any active thread-global transaction. What does "clear" mean? Does
this mean commit, or rollback?
If the transaction is marked as bad, "rollback" is obviously
appropriate - but what if the transaction isn't marked bad? What if
the developer just wants to commit the active thread-global
transaction for his own transactional management?
I don't think the spec would suffer any if closeTransaction() was
replaced with commitTransaction() and rollbackTransaction(). The only
additional complexity would be specifying that if the developer tries
to commit a bad transaction, an exception is thrown.
If we stick with just closeTransaction(), at the very least the spec
needs to be more precise on what closeTransaction() actually does.
More information about the whatwg