- From: Doug Reeder <dreeder5@columbus.rr.com>
- Date: Sat, 4 Apr 2009 03:48:56 -0400
- To: public-webapps@w3.org
The scenario where I need to use HTML 5 Database storage requires storing a tree of data. Each item has a unique id, generated by the database. Child nodes have a "parentId" field which points to their parent ID. Creating the records for a new tree in the database requires multiple transactions. First, the root item must be created. When the callback returns, the children of the root item can be created, because the id of the root item is now known. For each child, when the appropriate callback returns, the children of the child can be created, because their parent IDs are now known, and so forth. Minimizing the number of transactions (and thus the overall time to create a database) requires there be multiple transactions outstanding at any given time. Thus, when a callback function is called, it needs to determine _which_ transaction has completed. The current version of the HTML 5 Database storage spec does not make this easy. It is straightforward for my app to generate a unique ID for each transaction, but the spec provides no way to pass this to the callbacks. In JavaScript, I can add an "id" field to the transaction object, but then the _same_ id gets passed to each statement callback, and the transaction object is not passed _at all_ to the transaction success callback. I'm sure there are other scenarios where it would be useful for a statement callback to know which statement has completed, and for a transaction callback to know which transaction has just completed. Thank you.
Received on Thursday, 9 April 2009 09:34:47 UTC