W3C home > Mailing lists > Public > public-html-commits@w3.org > December 2008

html5/spec Overview.html,1.1777,1.1778

From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 29 Dec 2008 09:59:54 +0000
To: public-html-commits@w3.org
Message-Id: <E1LHEug-0008EP-Ax@lionel-hutz.w3.org>

Update of /sources/public/html5/spec
In directory hutz:/tmp/cvs-serv31625

Modified Files:
	Overview.html 
Log Message:
SQL: Split the transaction() method into two, one for read/write access and one for shared read access. (whatwg r2607)

Index: Overview.html
===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.1777
retrieving revision 1.1778
diff -u -d -r1.1777 -r1.1778
--- Overview.html	29 Dec 2008 09:14:38 -0000	1.1777
+++ Overview.html	29 Dec 2008 09:59:51 -0000	1.1778
@@ -31779,9 +31779,8 @@
   will try to use hundreds of megabytes to declare this upfront,
   instead of the user agent prompting the user for permission to
   increase the quota every five megabytes.<pre class=idl>interface <dfn id=database>Database</dfn> {
-  void <a href=#dom-database-transaction title=dom-database-transaction>transaction</a>(in <a href=#sqltransactioncallback>SQLTransactionCallback</a> callback);
-  void <a href=#dom-database-transaction title=dom-database-transaction>transaction</a>(in <a href=#sqltransactioncallback>SQLTransactionCallback</a> callback, in <a href=#sqltransactionerrorcallback>SQLTransactionErrorCallback</a> errorCallback);
-  void <a href=#dom-database-transaction title=dom-database-transaction>transaction</a>(in <a href=#sqltransactioncallback>SQLTransactionCallback</a> callback, in <a href=#sqltransactionerrorcallback>SQLTransactionErrorCallback</a> errorCallback, in <a href=#voidcallback>VoidCallback</a> successCallback);
+  void <a href=#dom-database-transaction title=dom-database-transaction>transaction</a>(in <a href=#sqltransactioncallback>SQLTransactionCallback</a> callback, [Optional] in <a href=#sqltransactionerrorcallback>SQLTransactionErrorCallback</a> errorCallback, [Optional] in <a href=#voidcallback>VoidCallback</a> successCallback);
+  void <a href=#dom-database-readtransaction title=dom-database-readTransaction>readTransaction</a>(in <a href=#sqltransactioncallback>SQLTransactionCallback</a> callback, [Optional] in <a href=#sqltransactionerrorcallback>SQLTransactionErrorCallback</a> errorCallback, [Optional] in <a href=#voidcallback>VoidCallback</a> successCallback);
 
   readonly attribute DOMString <a href=#dom-database-version title=dom-database-version>version</a>;
   void <a href=#dom-database-changeversion title=dom-database-changeVersion>changeVersion</a>(in DOMString oldVersion, in DOMString newVersion, in <a href=#sqltransactioncallback>SQLTransactionCallback</a> callback, in <a href=#sqltransactionerrorcallback>SQLTransactionErrorCallback</a> errorCallback, in <a href=#voidcallback>VoidCallback</a> successCallback);
@@ -31794,13 +31793,16 @@
 interface <dfn id=sqltransactionerrorcallback>SQLTransactionErrorCallback</dfn> {
   void <span title=dom-sqltransactionerrorcallback-handleEvent>handleEvent</span>(in <a href=#sqlerror>SQLError</a> error);
 };</pre><p>The <dfn id=dom-database-transaction title=dom-database-transaction><code>transaction()</code></dfn>
-  method takes one or two arguments. When called, the method must
+  and <dfn id=dom-database-readtransaction title=dom-database-readTransaction><code>readTransaction()</code></dfn>
+  methods takes one to three arguments. When called, these method must
   immediately return and then asynchronously run the <a href=#transaction-steps>transaction
   steps</a> with the <i>transaction callback</i> being the first
   argument, the <i>error callback</i> being the second argument, if
   any, the <i>success callback</i> being the third argument, if any,
   and with no <i>preflight operation</i> or <i>postflight
-  operation</i>.<p>The version that the database was opened with is the <dfn id=concept-database-expected-version title=concept-database-expected-version>expected version</dfn> of
+  operation</i>.<p>For the <code title=dom-database-transaction><a href=#dom-database-transaction>transaction()</a></code> method, the
+  <i>mode</i> must be read/write. For the <code title=dom-database-readTransaction><a href=#dom-database-readtransaction>readTransaction()</a></code>
+  method, the <i>mode</i> must be read-only.<p>The version that the database was opened with is the <dfn id=concept-database-expected-version title=concept-database-expected-version>expected version</dfn> of
   this <code><a href=#database>Database</a></code> object. It can be the empty string, in
   which case there is no expected version &mdash; any version is
   fine.<p>On getting, the <dfn id=dom-database-version title=dom-database-version><code>version</code></dfn> attribute
@@ -31818,7 +31820,7 @@
    exactly matches the database's actual version. If it does not, then
    the <i>preflight operation</i> fails.</li>
 
-  </ol><p>...and the <i>postflight operation</i> being the following:<ol><li>Change the database's actual version to the value of the second
+  </ol><p>...the <i>postflight operation</i> being the following:<ol><li>Change the database's actual version to the value of the second
    argument to the <code title=dom-database-changeVersion><a href=#dom-database-changeversion>changeVersion()</a></code>
    method.</li>
 
@@ -31826,7 +31828,7 @@
    the value of the second argument to the <code title=dom-database-changeVersion><a href=#dom-database-changeversion>changeVersion()</a></code>
    method.</li>
 
-  </ol><h5 id=executing-sql-statements><span class=secno>5.10.2.3 </span>Executing SQL statements</h5><p>The <code title=dom-database-transaction><a href=#dom-database-transaction>transaction()</a></code>
+  </ol><p>...and the <i>mode</i> being read/write.<h5 id=executing-sql-statements><span class=secno>5.10.2.3 </span>Executing SQL statements</h5><p>The <code title=dom-database-transaction><a href=#dom-database-transaction>transaction()</a></code>
   and <code title=dom-database-changeVersion><a href=#dom-database-changeversion>changeVersion()</a></code>
   methods invoke callbacks with <code><a href=#sqltransaction>SQLTransaction</a></code>
   objects.<pre class=idl>typedef sequence&lt;any&gt; <dfn id=objectarray>ObjectArray</dfn>;
@@ -32006,12 +32008,18 @@
   be run asynchronously. These steps are invoked with a <i>transaction
   callback</i>, optionally an <i>error callback</i>, optionally a
   <i>success callback</i>, optionally a <i>preflight operation</i>,
-  and optionally a <i>postflight operation</i>.<ol><li><p>Open a new SQL transaction to the database, and create a
+  optionally a <i>postflight operation</i>, and with a <i>mode</i>
+  that is either read/write or read-only.<ol><li><p>Open a new SQL transaction to the database, and create a
    <code><a href=#sqltransaction>SQLTransaction</a></code> object that represents that
-   transaction.</li>
+   transaction. If the <i>mode</i> is read/write, the transaction must
+   have an exclusive write lock over the entire database. If the
+   <i>mode</i> is read-only, the transaction must have a shared read
+   lock over the entire database. The user agent should wait for an
+   appropriate lock to be available..</li>
 
-   <li><p>If an error occurred in the opening of the transaction, jump
-   to the last step.</li>
+   <li><p>If an error occurred in the opening of the transaction
+   (e.g. if the user agent failed to obtain an appropriate lock after
+   an appropriate delay), jump to the last step.</li>
 
    <li><p>If a <i>preflight operation</i> was defined for this
    instance of the transaction steps, run that. If it fails, then jump
@@ -32040,6 +32048,20 @@
     <ol><li><p>If the statement is marked as bogus, jump to the "in case
      of error" steps below.</li>
 
+     <li id=modifications-fail-if-read-only>
+
+      <p>If the <i>mode</i> is read-only but the statement's main verb
+      can modify the database, jump to the "in case of error" steps
+      below.</p>
+
+      <p class=note>Only the statement's main verb (e.g. <code title="">UPDATE</code>, <code title="">SELECT</code>, <code title="">DROP</code>) is considered here. Thus, a statement like
+      "<code title="">UPDATE test SET id=0 WHERE 0=1</code>" would be
+      treated as potentially modifying the database for the purposes
+      of this step, even though it could never in fact have any
+      side-effects.</p>
+
+     </li>
+
      <li><p>Execute the statement in the context of the transaction.
      <a href=#references>[SQL]</a></p>
 
Received on Monday, 29 December 2008 10:00:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 29 December 2008 10:00:07 GMT