Re: [IndexedDB] IDBDAtabase.transaction clarification

On Thu, Feb 23, 2012 at 9:27 PM, Joćo Eiras <joaoe@opera.com> wrote:
>
> Hi.
>
> It seems IDBDatabase.transaction in the working draft is poorly defined.
>
> IDBDatabase.transaction, according to the transaction creation algorithm,
> have a null callback, but then IDBDatabase.createObjectStore and
> IDBDatabase.deleteObjectStore say they should fail if not called from the
> transaction callback. I think it should be changed so they fail if there
> is not an active transaction, or that the current active transaction is
> not a VERSION_CHANGE one. Is this the intended behavior ?

Yes. Please file a bug.

> It tells IDBDatabase.transaction returns the IDBTransaction object.
> Shouldn't it be an IDBRequest object ? If not, then what the lifetime of
> the transaction ? When should it be commited ?

IDBTransaction is correct.

How committing works should be detailed in the Transaction part of the
Constructs section:

http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#transaction-concept

> IDBDatabase.transaction accepts either an array of strings or string as
> first argument, which are the name of the object stores. What should
> be used for the very first transaction of an empty database with no
> object stores ? Empty array ?

When a database is created a VERSION_CHANGE transaction is
automatically created. So there is no need to call
IDBDatabase.transaction. Not entirely sure I understand the question
here.

/ Jonas

Received on Thursday, 23 February 2012 21:16:01 UTC