<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br><div><div>On Sep 22, 2007, at 9:32 AM, Aaron Boodman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I agree with both Maciej's points, and want the second one more than he did.<br><br>Additional comments:<br><br>4.12.3, step 3:<br><br>I don't think you should implicitly join active transactions unless<br>you're inside a callback from a previous executeSql call. Otherwise<br>all code that wants to call executeSql needs to know about all other<br>code using it and know to wait if it wants isolation. In the case<br>where you're a top-level call to executeSql, you should start a new<br>transaction.</blockquote><div><br class="webkit-block-placeholder"></div><div>This is a little unclear, but I think the spec has the behavior you suggest already.</div><div><br class="webkit-block-placeholder"></div><div>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.</div><div><br class="webkit-block-placeholder"></div><div>I agree with the remainder of your comments (which I omitted).</div><div><br class="webkit-block-placeholder"></div><div>Another comment:</div><div><br class="webkit-block-placeholder"></div><div>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:</div><div><br class="webkit-block-placeholder"></div><div>void executeSql(in sequence<Object> sqlStatements, in SQLMultiCallback callback);</div><div><br class="webkit-block-placeholder"></div><div>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:</div><div><br class="webkit-block-placeholder"></div><div>db.executeSql(['INSERT INTO "db1" ("column1") VALUES ("value1")',</div><div>                      ['<span class="Apple-style-span" style="font-family: Arial; font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px; ">UPDATE "counter" SET "version" = ? WHERE "version" = ?', v + 1, v]],</span></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px;">function (resultArray) {</span></font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px;">    // ... do stuff ...</span></font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px;">});</span></font></div></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px;"><br class="webkit-block-placeholder"></span></font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px;">Otherwise, there's no way to put multiple independent statements inside a transaction from top level.</span></font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px;"><br class="webkit-block-placeholder"></span></font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px;">Regards,</span></font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px;">Maciej</span></font></div><div><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; -webkit-border-horizontal-spacing: 10px; -webkit-border-vertical-spacing: 10px;"><br class="webkit-block-placeholder"></span></font></div></body></html>