Skip to content

Commit

Permalink
[] (0) Rework the way SQL results are returned.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@1029 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 25, 2007
1 parent 3530a03 commit 7e17a0b
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 236 deletions.
192 changes: 65 additions & 127 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -29888,7 +29888,7 @@ interface <dfn id=storageitem>StorageItem</dfn> {
};

interface <dfn id=sqlcallback>SQLCallback</dfn> {
void <span title=dom-sqlcallback-handleEvent>handleEvent</span>(in <a href="#resultset">ResultSet</a> resultSet);
void <span title=dom-sqlcallback-handleEvent>handleEvent</span>(in <a href="#sqlresultset">SQLResultSet</a> resultSet);
};</pre>

<p>The <dfn id=version
Expand Down Expand Up @@ -29967,7 +29967,7 @@ interface <dfn id=sqlcallback>SQLCallback</dfn> {

<li>
<p>Once the statement has executed, let <var title="">result</var> be a
new <code><a href="#resultset">ResultSet</a></code> object that
new <code><a href="#sqlresultset">SQLResultSet</a></code> object that
represents the result of this statement's execution.

<li>
Expand Down Expand Up @@ -30039,97 +30039,46 @@ interface <dfn id=sqlcallback>SQLCallback</dfn> {

<h4 id=database><span class=secno>4.12.4. </span>Database query results</h4>

<p>Calls to the <code title=dom-database-executeSql><a
href="#executesql">executeSql()</a></code> method return <code><a
href="#resultset">ResultSet</a></code> objects.

<pre class=idl>interface <dfn id=resultset>ResultSet</dfn> {
// cursor
readonly attribute boolean <a href="#validrow" title=dom-ResultSet-validRow>validRow</a>;
void <a href="#next0" title=dom-ResultSet-next>next</a>();

// current row accessors
readonly attribute unsigned int <a href="#length8" title=dom-ResultSet-length>length</a>;
DOMString <a href="#getname" title=dom-ResultSet-getName>getName</a>(in unsigned int field);
Object <a href="#itemfield" title=dom-ResultSet-item>item</a>(in unsigned int field);
Object <a href="#nameditem3" title=dom-ResultSet-namedItem>namedItem</a>(in DOMString field);

// general result accessors
readonly attribute int <a href="#insertid" title=dom-ResultSet-insertId>insertId</a>;
readonly attribute unsigned int <a href="#errorcode" title=dom-ResultSet-errorCode>errorCode</a>;
readonly attribute DOMString <a href="#error2" title=dom-ResultSet-error>error</a>;
<p>The <code title=dom-database-executeSql><a
href="#executesql">executeSql()</a></code> method invokes its callback
with a single argument, an <code><a
href="#sqlresultset">SQLResultSet</a></code> object.

<pre class=idl>interface <dfn id=sqlresultset>SQLResultSet</dfn> {
readonly attribute Array <a href="#rows1" title=dom-SQLResultSet-rows>rows</a>;
readonly attribute int <a href="#insertid" title=dom-SQLResultSet-insertId>insertId</a>;
readonly attribute int <a href="#rowsaffected" title=dom-SQLResultSet-rowsAffected>rowsAffected</a>;
readonly attribute unsigned int <span title=dom-SQLResultSet-errorCode>errorCode</span>;
readonly attribute DOMString <a href="#error2" title=dom-SQLResultSet-error>error</a>;
};</pre>

<p>A <code><a href="#resultset">ResultSet</a></code> object has a cursor
which visits the results of a SQL statement, in the order returned.
Initially, the cursor must point at the first row returned by the
statement, if any. Once a row has been visited, it cannot be visited again
(the cursor cannot go backwards).

<p>The <dfn id=validrow
title=dom-ResultSet-validRow><code>validRow</code></dfn> attribute must
return return true if the <code><a href="#resultset">ResultSet</a></code>
object's cursor is at a row with data. If the cursor has been moved beyond
the last row of the results, or if there were no results for the SQL
statement in question, then the method must return false.

<p>The <dfn id=next0 title=dom-ResultSet-next><code>next()</code></dfn>
method must advance the cursor to the next row. If there are no more rows
it must advance the cursor past the end of the results, so that <code
title=dom-ResultSet-validRow><a href="#validrow">validRow</a></code> will
return false.

<p>Each row of the results consists of a set of fields. Each field has a
name and a value. The fields are ordered. The names of the fields, and
their order, must be the same for every row in the results.

<p>The <dfn id=length8 title=dom-ResultSet-length><code>length</code></dfn>
attribute must return the number of fields in each row. If the <code><a
href="#resultset">ResultSet</a></code> object has no results rows (i.e. if
the SQL statement executed did not return any results) then the attribute
must return zero.

<p>The <dfn id=getname title=dom-ResultSet-getName><code>getName(<var
title="">field</var>)</code></dfn> method must return the name of the
field with index <var title="">field</var>.

<p>The <dfn id=itemfield title=dom-ResultSet-item><code>item(<var
title="">field</var>)</code></dfn> method must return the value of the
field with index <var title="">field</var>. In the ECMAScript binding, the
object's [[Get]] method, when invoked with a numeric argument, must have
the same effect as calling the <code title=dom-ResultSet-item><a
href="#itemfield">item()</a></code> method.

<p>If the <var title="">field</var> argument of either the <code
title=dom-ResultSet-getName><a href="#getname">getName()</a></code> or
<code title=dom-ResultSet-item><a href="#itemfield">item()</a></code>
methods is ever less than zero or greater than or equal to the number of
fields in each row, or if those methods are called when the <code><a
href="#resultset">ResultSet</a></code> object has no results rows, the
methods must instead raise an <code>INDEX_SIZE_ERR</code> exception.

<p>The <dfn id=nameditem3
title=dom-ResultSet-namedItem><code>namedItem(<var
title="">field</var>)</code></dfn> method must return the value of the
field with the name <var title="">field</var>. If there is no field with
that name, the method must instead raise a <code>SYNTAX_ERR</code>
exception. In the ECMAScript binding, the object's [[Get]] method, when
invoked with a non-numeric argument, must have the same effect as calling
the <code title=dom-ResultSet-namedItem><a
href="#nameditem3">namedItem()</a></code> method.
<p>The <dfn id=rows1 title=dom-SQLResultSet-rows><code>rows</code></dfn>
attribute must return a native array of objects, one per row returned, in
the order returned by the database. Each object returned must have one
property per column, enumerating in the order that these columns were
returned by the database. Each property must have the name of the column
as it was returned by the database. If the SQL statement failed, then
<code title=dom-SQLResultSet-rows><a href="#rows1">rows</a></code> must
return null.

<p>The <dfn id=insertid
title=dom-ResultSet-insertId><code>insertId</code></dfn> attribute must
title=dom-SQLResultSet-insertId><code>insertId</code></dfn> attribute must
return the row ID of the row that the <code><a
href="#resultset">ResultSet</a></code> object's SQL statement inserted
into the database, if the statement inserted a row. If the statement
inserted multiple rows, the ID of the last row must be the one returned.
If the statement did not insert a row, then the attribute must instead
raise an <code>INVALID_ACCESS_ERR</code> exception.
href="#sqlresultset">SQLResultSet</a></code> object's SQL statement
inserted into the database, if the statement inserted a row. If the
statement inserted multiple rows, the ID of the last row must be the one
returned. If the statement did not insert a row, then the attribute must
instead raise an <code>INVALID_ACCESS_ERR</code> exception.

<p>The <dfn id=rowsaffected
title=dom-SQLResultSet-rowsAffected><code>rowsAffected</code></dfn>
attribute must return the number of rows that were affected by the SQL
statement. If the statement failed, or did not affected any rows, then the
attribute must return zero.

<p>The <dfn id=errorcode
title=dom-ResultSet-errorCode><code>errorCode</code></dfn> DOM attribute
must return the most appropriate code from the following table:
title=dom-ResultSetSQL-errorCode><code>errorCode</code></dfn> DOM
attribute must return the most appropriate code from the following table:

<table>
<thead>
Expand All @@ -30144,7 +30093,7 @@ interface <dfn id=sqlcallback>SQLCallback</dfn> {

<td>The statement was successful, any data available will be returned by
the other methods and attributes of the <code><a
href="#resultset">ResultSet</a></code> object.
href="#sqlresultset">SQLResultSet</a></code> object.

<tr>
<td>1
Expand All @@ -30167,23 +30116,11 @@ interface <dfn id=sqlcallback>SQLCallback</dfn> {
<p class=big-issue>We should define a more thorough list of codes.
Implementation feedback is requested to determine what codes are needed.

<p>The <dfn id=error2 title=dom-ResultSet-error><code>error</code></dfn>
<p>The <dfn id=error2 title=dom-SQLResultSet-error><code>error</code></dfn>
DOM attribute must return an error message, localised to the user's
language, describing the error encountered by the last statement. If there
was no error, the attribute's value must be the empty string.

<p>If the statement failed, then <code title=dom-ResultSet-validRow><a
href="#validrow">validRow</a></code>, <code title=dom-ResultSet-next><a
href="#next0">next()</a></code>, <code title=dom-ResultSet-length><a
href="#length8">length</a></code>, <code title=dom-ResultSet-getName><a
href="#getname">getName()</a></code>, <code title=dom-ResultSet-item><a
href="#itemfield">item()</a></code>, <code
title=dom-ResultSet-namedItem><a href="#nameditem3">namedItem()</a></code>
and <code title=dom-ResultSet-insertId><a
href="#insertid">insertId</a></code> must all raise <code
title="">INVALID_STATE_ERR</code> exceptions on getting, setting, or
calling (as appropriate).

<h4 id=privacy><span class=secno>4.12.5. </span>Privacy</h4>

<p>In contrast with the <code title=dom-globalStorage><a
Expand Down Expand Up @@ -31679,7 +31616,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
void <a href="#clearundo" title=dom-UndoManager-clearUndo>clearUndo</a>();
void <a href="#clearredo" title=dom-UndoManager-clearRedo>clearRedo</a>();
DOMObject <a href="#itemn" title=dom-UndoManager-item>item</a>(in unsigned long index);
readonly attribute unsigned long <a href="#length9" title=dom-UndoManager-length>length</a>;
readonly attribute unsigned long <a href="#length8" title=dom-UndoManager-length>length</a>;
readonly attribute unsigned long <a href="#position0" title=dom-UndoManager-position>position</a>;
};</pre>

Expand All @@ -31704,7 +31641,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
entries are absent from the <a href="#undo-transaction">undo transaction
history</a>.

<p>The <dfn id=length9
<p>The <dfn id=length8
title=dom-UndoManager-length><code>length</code></dfn> attribute must
return the number of <a href="#undo-object">undo object</a> entries in the
<a href="#undo-transaction">undo transaction history</a>.
Expand All @@ -31728,7 +31665,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
nearest to the <a href="#current3">undo position</a>, on the "redo" side.
If there are no <a href="#undo-object">undo object</a> entries on the
"redo" side, then the attribute must return the same as the <code
title=dom-UndoManager-length><a href="#length9">length</a></code>
title=dom-UndoManager-length><a href="#length8">length</a></code>
attribute. If there are no <a href="#undo-object">undo object</a> entries
on the "undo" side of the <a href="#current3">undo position</a>, the <code
title=dom-UndoManager-position><a href="#position0">position</a></code>
Expand Down Expand Up @@ -31775,7 +31712,7 @@ http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSPr
href="#undo-object">undo object</a> entry with the specified <var
title="">index</var>. If the index is less than zero or greater than or
equal to <code title=dom-UndoManager-length><a
href="#length9">length</a></code> then the method must raise an
href="#length8">length</a></code> then the method must raise an
<code>INDEX_SIZE_ERR</code> exception. <a href="#dom-changes">DOM
changes</a> entries are unaffected by this method.

Expand Down Expand Up @@ -43032,29 +42969,30 @@ interface <dfn id=timeouthandler>TimeoutHandler</dfn> {

<h2 class=no-num id=acknowledgements>Acknowledgements</h2>

<p>Thanks to Aankhen, Aaron Leventhal, Adrian Sutton, Agust&iacute;n
Fern&aacute;ndez, Alexey Feldgendler, Andrew Gove, Andrew Sidwell, Anne
van Kesteren, Anthony Hickson, Asbj&oslash;rn Ulsberg, Ben Godfrey, Ben
Meadowcroft, Benjamin Hawkes-Lewis, Bert Bos, Bjoern Hoehrmann, Boris
Zbarsky, Brad Fults, Brad Neuberg, Brendan Eich, Brett Wilson, Carlos
Perell&oacute; Mar&iacute;n, Chao Cai, &#xc724;&#xc11d;&#xcc2c; (Channy
Yun), Charl van Niekerk<!--status.whatwg.org maintainer-->, Charles Iliya
Krempeaux, Charles McCathieNevile, Christian Biesinger, Christian
Johansen, Chriswa, Daniel Peng, Daniel Sp&aring;ng, Darin Alder, Darin
Fisher, Dave Townsend<!-- Mossop on moz irc -->, David Baron, David
Flanagan, David H&aring;s&auml;ther, David Hyatt, Derek Featherstone,
Dimitri Glazkov, dolphinling, Doron Rosenberg, Eira Monstad, Elliotte
Harold, Erik Arvidsson, Evan Martin, fantasai, Franck 'Shift'
Qu&eacute;lain, Geoffrey Sneddon, H&aring;kon Wium Lie, Henri Sivonen,
Henrik Lied, Ignacio Javier, J. King, James Graham, James M Snell, James
Perrett, Jan-Klaas Kollhof, Jasper Bryant-Greene, Jeff Cutsinger, Jeff
Walden, Jens Bannmann, Jeroen van der Meer, Joel Spolsky, John Boyer, John
Harding, Johnny Stenback, Jon Perlow, Jonathan Worent, Jorgen Horstink,
Josh Levenberg, Joshua Randall, Jukka K. Korpela, Kai Hendry, <!-- Keryx
Web, = Lars Gunther -->
Kornel Lesinski, &#x9ed2;&#x6fa4;&#x525b;&#x5fd7; (KUROSAWA Takeshi),
Kristof Zelechovski, Lachlan Hunt, Larry Page, Lars Gunther, Laurens
Holst, Lenny Domnitser, L&eacute;onard Bouchet, Leons Petrazickis,
<p>Thanks to Aankhen, Aaron Boodman, Aaron Leventhal, Adrian Sutton,
Agust&iacute;n Fern&aacute;ndez, Alexey Feldgendler, Andrew Gove, Andrew
Sidwell, Anne van Kesteren, Anthony Hickson, Asbj&oslash;rn Ulsberg, Ben
Godfrey, Ben Meadowcroft, Benjamin Hawkes-Lewis, Bert Bos, Bjoern
Hoehrmann, Boris Zbarsky, Brad Fults, Brad Neuberg, Brendan Eich, Brett
Wilson, Carlos Perell&oacute; Mar&iacute;n, Chao Cai,
&#xc724;&#xc11d;&#xcc2c; (Channy Yun), Charl van
Niekerk<!--status.whatwg.org maintainer-->, Charles Iliya Krempeaux,
Charles McCathieNevile, Christian Biesinger, Christian Johansen, Chriswa,
Daniel Peng, Daniel Sp&aring;ng, Darin Alder, Darin Fisher, Dave
Townsend<!-- Mossop on moz irc -->, David Baron, David Flanagan, David
H&aring;s&auml;ther, David Hyatt, Derek Featherstone, Dimitri Glazkov,
dolphinling, Doron Rosenberg, Eira Monstad, Elliotte Harold, Erik
Arvidsson, Evan Martin, fantasai, Franck 'Shift' Qu&eacute;lain, Geoffrey
Sneddon, H&aring;kon Wium Lie, Henri Sivonen, Henrik Lied, Ignacio Javier,
J. King, James Graham, James M Snell, James Perrett, Jan-Klaas Kollhof,
Jasper Bryant-Greene, Jeff Cutsinger, Jeff Walden, Jens Bannmann, Jeroen
van der Meer, Joel Spolsky, John Boyer, John Harding, Johnny Stenback, Jon
Perlow, Jonathan Worent, Jorgen Horstink, Josh Levenberg, Joshua Randall,
Jukka K. Korpela, Kai Hendry, <!-- Keryx
Web, = Lars Gunther --> Kornel
Lesinski, &#x9ed2;&#x6fa4;&#x525b;&#x5fd7; (KUROSAWA Takeshi), Kristof
Zelechovski, Lachlan Hunt, Larry Page, Lars Gunther, Laurens Holst, Lenny
Domnitser, L&eacute;onard Bouchet, Leons Petrazickis,
Logan<!-- on moz irc -->, Loune, Maciej Stachowiak, Malcolm Rowe, Mark
Nottingham, Mark Rowe<!--bdash-->, Mark Schenk, Martijn Wargers, Martin
Atkins, Martin Honnen, Mathieu Henri, Matthew Mastracci, Matthew Raymond,
Expand Down
Loading

0 comments on commit 7e17a0b

Please sign in to comment.