<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I originally had some objections to this, but think it might be okay.<div><br class="webkit-block-placeholder"></div><div>My understanding with this design is that you would get this SQLTransaction object back and it would just sit around, not doing anything. When you first call executeSql on it, you kick off the transaction steps as they already exist. Until you call executeSql(), it's just a dummy object that doesn't interfere with the database at all.</div><div><br class="webkit-block-placeholder"></div><div>If the above understanding is how we change the spec, I'm all for it.</div><div><br></div><div>Thanks,</div><div>~Brady</div><div><br class="webkit-block-placeholder"></div><div><div><div>On Oct 31, 2007, at 11:40 AM, Timothy Hatcher wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>I have finally looked over the new syntax and I'm starting to like how transactions are handled now. However, I feel the current spec has taken a turn towards a more complex model even for simple queries that don't require transactions.</div><div><br></div><div>Compare:</div><div><span class="Apple-style-span" style="font-family: Times; font-size: 10px; "><pre style="word-wrap: break-word; white-space: pre-wrap; ">db.executeSql("CREATE TABLE WebKitStickyNotes (id REAL UNIQUE, note TEXT, timestamp REAL, left TEXT, top TEXT, zindex REAL)", []);</pre><pre style="word-wrap: break-word; white-space: pre-wrap; "><font class="Apple-style-span" color="#000000" face="Verdana" size="3"><span class="Apple-style-span" style="background-color: transparent; font-size: 11px;">and</span></font></pre><pre style="word-wrap: break-word; white-space: pre-wrap; "><span class="Apple-style-span" style="font-family: Times; white-space: normal; "><pre style="word-wrap: break-word; white-space: pre-wrap; ">db.transaction(function(transacion) { transacion.executeSql("CREATE TABLE WebKitStickyNotes (id REAL UNIQUE, note TEXT, timestamp REAL, left TEXT, top TEXT, zindex REAL)", []) });</pre></span></pre></span></div><div>I think there needs to be an executeSql on the Database object still. Using executeSql on the Database will just queue up statements interleaved with the transactions.</div><div><br class="webkit-block-placeholder"></div><div>The other problem I see that makes the current spec more complex is the transaction callback. I think a better API would be:</div><div><br class="webkit-block-placeholder"></div><div><div><div><font class="Apple-style-span" color="#000000" face="Monaco" size="2"><span class="Apple-style-span" style="background-color: transparent; font-size: 10px;">SQLTransaction transaction();</span></font></div><div><font class="Apple-style-span" color="#000000" face="Monaco" size="2"><span class="Apple-style-span" style="background-color: transparent; font-size: 10px;">SQLTransaction transaction(in SQLTransactionErrorCallback errorCallback);</span></font></div><div><br class="webkit-block-placeholder"></div></div><div>Then you can call executeSql on the transaction object without having to wait for the callback. Sure, closures in JavaScript make this somewhat less painful, but closures are usually expensive and add additional complexity. Not to mention JavaScript is not the only language that the DOM can be accessed from, for example in WebKit using Objective-C where doing callbacks is a greater hassle.</div></div><div><br class="webkit-block-placeholder"></div><div> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Verdana; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px;"><span class="Apple-style-span" style="font-size: 10px; ">— Timothy Hatcher</span></span></font></div></div><br class="Apple-interchange-newline"></span> </div><br></div></blockquote></div><br></div></body></html>