- From: Maciej Stachowiak <mjs@apple.com>
- Date: Sat, 22 Sep 2007 20:20:06 -0700
On Sep 22, 2007, at 9:32 AM, Aaron Boodman wrote: > I agree with both Maciej's points, and want the second one more than > he did. > > Additional comments: > > 4.12.3, step 3: > > I don't think you should implicitly join active transactions unless > you're inside a callback from a previous executeSql call. Otherwise > all code that wants to call executeSql needs to know about all other > code using it and know to wait if it wants isolation. In the case > where you're a top-level call to executeSql, you should start a new > transaction. This is a little unclear, but I think the spec has the behavior you suggest already. There is a distinction between "transaction", which is essentially a local variable to a specific pass through the algorithm, and the "active thread-global transaction". "transaction" is set in step 3, but the "active thread-global transaction" is not set until step 8, which is after the method has returned and when you are about to dispatch the callback, and is cleared after the callback is dispatched. However, this is less than perfectly clear in the spec, as you were not the only one confused on this point. I think the spec could make this more clear. I agree with the remainder of your comments (which I omitted). Another comment: Sometimes it's useful to schedule multiple SQL queries in a single transaction at once, without a separate async callback for each. We discussed possible syntax something like the following: void executeSql(in sequence<Object> sqlStatements, in SQLMultiCallback callback); sqlStatements is an Array where each element is either a string or an array. If a string, it is strated as a standalone statement. If an array, it the first element of that nested array is a statement with ? slots for parameter substitution and the remainder of the elements are arrays. SQLMultiCallback is like SQLCallback but gets an array of ResultSets. Example: db.executeSql(['INSERT INTO "db1" ("column1") VALUES ("value1")', ['UPDATE "counter" SET "version" = ? WHERE "version" = ?', v + 1, v]], function (resultArray) { // ... do stuff ... }); Otherwise, there's no way to put multiple independent statements inside a transaction from top level. Regards, Maciej -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070922/3144888d/attachment.htm>
Received on Saturday, 22 September 2007 20:20:06 UTC