On Sep 20, 2007 1:14 PM, Timothy Hatcher <<a href="mailto:timothy@apple.com" target="_blank">timothy@apple.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div>The pain of asynchronous access can be alleviated or even solved with an API for transactions, or a group of SQL queries that need be executed in order. Commonly, if a transaction fails in the middle, the database is rolled-back to the state before the transaction started.
</div></div></blockquote><div><br>It sounds like what you're talking about is something like:<br><br>var tx = new Transaction();<br>tx.addStatement("insert into accounts values (?, ?)", ["foo", "bar"]);
<br>tx.addStatement("update persons set name = ?, age = ?", ["bob", 42]);<br>tx.executeAsync(callback, errback);<br><br>This only works so long as you can construct all the sql calls ahead of time. If any calls depend on the results of previous ones, you need something like a worker.
<br><br>But I agree that the api needs support for transactions, I wanted to start another thread about that.<br><br>- a<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div><br></div><div>There can then be a callback when the transaction finished or fails, with details on what query failed.</div><div><div><br></div><div><div>On Sep 20, 2007, at 10:13 AM, Aaron Boodman wrote:
</div><br><blockquote type="cite"><span style="border-collapse: separate; 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-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
That said, it will be even more common with databases to have multiple asynchronous operations in a row than it is today with XHR. Doing this all asynchronously will be incredibly painful.<span> </span><br></span></blockquote>
</div><br></div><font color="#888888"><div> <span style="border-collapse: separate; border-spacing: 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-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<div><div style="margin: 0px;"><font size="2"><span style="font-size: 10px;"><span style="font-size: 10px;">— Timothy Hatcher</span></span></font></div></div><br></span> </div><br></font></div></blockquote></div>
<br>