W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010

Re: [IndexedDB] Implicit transactions

From: Jeremy Orlow <jorlow@chromium.org>
Date: Thu, 5 Aug 2010 11:04:52 +0100
Message-ID: <AANLkTimx80YGRYyzOTeCQkvmnYBoiaH-XE3H+KE-8qxN@mail.gmail.com>
To: Shawn Wilsher <sdwilsh@mozilla.com>
Cc: public-webapps WG <public-webapps@w3.org>
On Wed, Aug 4, 2010 at 7:47 PM, Shawn Wilsher <sdwilsh@mozilla.com> wrote:

>  On 8/4/2010 10:53 AM, Jeremy Orlow wrote:
>> Whoa....transaction() is synchronous?!?  Ok, so I guess the entire premise
>> of my question was super confused.  :-)
>>  It is certainly spec'd that way [1].  The locks do not get acquired until
> the first actual bit of work is done though.

I fully understand how the trick works.  I just didn't comprehend the fact
that the Mozilla proposal (what's now in the spec) was removing any way to
get into an IDBTransactionEvent handler besides doing an initial data
access.  I wouldn't have agreed to the proposal had I realized this.

Lets say I had the following bit of initialization code in my program:

var myDB = ...
var myObjectStore = myDB.objectStore("someObjectStore");
var myIndex = myObjectStore.index("someIndex");
var anotherObjectStore = myDB.objectStore("anotherObjectStore");

And then I wanted to start a transaction that'd access some key and then
presumably do some other work.  As currently specced, here's what I'd need
to do:


vs doing something like this:

myDB.asyncTransaction().onsuccess(function() {
    myIndex.get("someKey").onsuccess(function() {

With the former, we actually have more typing and the code is harder to
read.  Sure, when I'm writing short code snipits, the synchronous form can
be more convenient and readable, but forcing this upon every situation is
going to be a hinderance.

Please, lets add back in a transaction method that returns an IDBRequest.

Received on Thursday, 5 August 2010 10:10:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:10 UTC