Platform Support
Jaxer Server Framework | Jaxer Client Framework | 1.0 | no |
---|
Constructors
Constructor | Action | Jaxer Server Framework | Jaxer Client Framework | ||
---|---|---|---|---|---|
Jaxer.DB.ResultSet Constructor() : Jaxer.DB.ResultSet
Returned value of a SQL query, containing the named rows and columns of the result and to be used as the return value of execute().
Each row has a special property, $values, that is an array ordered according to the columns array. The rowsAsArray array is
similar to the rows array but each row in it is an array itself: it is the corresponding $values array. To see if there is
any data, check whether hasData is true or whether rows.length or rowsAsArrays.length exceed 0. To get a single result (the
first column of the first row) grab singleResult.
|
Show Details | 1.0 | no | ||
Jaxer.DB.ResultSet() : Jaxer.DB.ResultSetReturned value of a SQL query, containing the named rows and columns of the result and to be used as the return value of execute(). Each row has a special property, $values, that is an array ordered according to the columns array. The rowsAsArray array is similar to the rows array but each row in it is an array itself: it is the corresponding $values array. To see if there is any data, check whether hasData is true or whether rows.length or rowsAsArrays.length exceed 0. To get a single result (the first column of the first row) grab singleResult. Returns
|
Properties
Property | Action | Jaxer Server Framework | Jaxer Client Framework |
---|---|---|---|
An array of column names for all rows in this resultSet. TODO - Note that (depending on the DB "driver" implementation used)
the columns array may be empty if there are no rows of data; this will be fixed in the future.
|
No Details | 1.0 | no |
|
|||
This returns the data in the last row of the resultSet as an array, or else it contains an empty array. (You can disambiguate
DB nulls from no data by checking the hasData property or rows.length).
|
No Details | 1.0 | no |
|
|||
firstRow
: Array
An alias of the Jaxer.DB.ResultSet.prototype.singleRow method
|
Show Details | 1.0 | no |
True if this resultSet contains any data, false otherwise.
|
No Details | 1.0 | no |
|
|||
The array of rows in the resultSet in the order retrieved from the database. Each row has properties corresponding to the
column names in the returned data. Each row also has a special property, $values, that's an array of the values in that row
(in the same order as the columns array).
|
No Details | 1.0 | no |
|
|||
An alternate representation of the rows of the resultSet: each row is itself an array, containing the values (cells) in that
row in the same order as the columns array.
|
No Details | 1.0 | no |
|
|||
This returns the data in each of the first columns of the resultSet as an array, or else it contains an empty array. (You
can disambiguate DB nulls from no data by checking the hasData property or rows.length). This is convenient for queries that
are used to populate dropdowns.
|
No Details | 1.0 | no |
|
|||
This contains the first value (cell) in the first row in the resultSet, if any, or else it contains null. (You can disambiguate
DB nulls from no data by checking the hasData property or rows.length). This is convenient for queries (e.g. "SELECT COUNT(*)
FROM mytable") that are known to return a single value.
|
No Details | 1.0 | no |
|
|||
This contains the data in the first row of the resultSet as an array, or else it contains an empty array. (You can disambiguate
DB nulls from no data by checking the hasData property or rows.length). This is convenient for queries (e.g. "SELECT * FROM
mytable where key = 'value'") that are known to return a single value.
|
No Details | 1.0 | no |
|
Functions
Method | Action | Jaxer Server Framework | Jaxer Client Framework | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
addRow(Object row) :
void
Adds a row, where its structure is assumed to be the same as all the other rows. Note that in particular it must have a $values
property.
|
Show Details | 1.0 | no | |||||||||||
Parameters
|
||||||||||||||
Closes this resultSet and empties its internal data structures. This is optional.
|
No Details | 1.0 | no | |||||||||||
|
||||||||||||||
columnsAsArray(Number identifies) : Array
This return the data in the provided columns of the resultSet as an array, or else it contains null.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
every(Function fn) : Boolean
every runs a function against each row in the recordset while that function is returning true. returns true if the function
returns true for every row it could visit The function is invoked with three arguments: - the value of the current row in
the resultset, - the index of the current row in the resultset, - an array representing the resultset being traversed.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
extractColumns(Array columns) : Array
Returns an array of objects, one per row, that only have properties corresponding to the given columns.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
field(Number fieldIndex) : Object
For the current row pointed to by the cursor, returns the value of the field (column) at the given (0-based) index, the same
as this.rowsAsArrays [ currentRowIndex ] [ fieldIndex ] Throws a Jaxer.Exception if fieldIndex is out of range.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
fieldByName(String fieldByName) : Object
For the current row pointed to by the cursor, returns the value of the field (column) at the given fieldName (column name),
the same as this.rows [ currentRowIndex ] [ fieldName ] Throws a Jaxer.Exception if fieldName is not the name of a field (column).
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
fieldCount() : Number
Returns the number of fields (columns) in this resultSet, the same as this.columns.length.
|
Show Details | 1.0 | no | |||||||||||
Returns
|
||||||||||||||
fieldName(Number fieldIndex) : String
Returns the name of the column at the given (0-based) index, the same as this.columns [ fieldIndex ] . Throws a Jaxer.Exception
if fieldIndex is out of range.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
filter(Function fn) : Array
filter returns a new array with all of the elements of this array for which the provided filtering function returns true.
The function is invoked with three arguments: - the value of the current row in the resultset, - the index of the current
row in the resultset, - an array representing the resultset being traversed.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
finalRowAsArray(Number identifies) : Array
This contains the requested columns from the last row of the resultSet as an array, or else it contains an empty array.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
forEach(Function fn) :
void
forEach executes the provided function (callback) once for each element present in the recordset. The callback is invoked
with three arguments: - the value of the current row in the resultset, - the index of the current row in the resultset, -
an array representing the resultset being traversed.
|
Show Details | 1.0 | no | |||||||||||
Parameters
|
||||||||||||||
indexOf(Number column, Object value, Number fromIndex) : Number
indexOf compares the value of the requested column in each row of the results using strict equality (the same method used
by the ===, or triple-equals, operator). it returns either the index of the first matched item or -1 if no items match
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
indexOfColumn(String columnName) : Number
Returns the index of the column with the given name
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
isValidRow() : Boolean
True if this resultSet's cursor is positioned on a valid row, which means you can access the row's data.
|
Show Details | 1.0 | no | |||||||||||
Returns
|
||||||||||||||
lastIndexOf(Number column, Object value, Number fromIndex) : Number
indexOf compares the value of the requested column in each row of the results using strict equality (the same method used
by the ===, or triple-equals, operator). it returns either the index of the last matched item or -1 if no items match
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
lastRowAsArray() :
void
An alias of the Jaxer.DB.ResultSet.prototype.finalRowAsArray method
|
Show Details | 1.0 | no | |||||||||||
map(Function fn) : Array
map runs a function on every row in the resultset and returns the results in an array. The row and index of the current item
are passed as parameters to the current function.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
Advances this resultSet's cursor to the next row of results. Use isValidRow() to determine if you've reached the end of the
rows.
|
No Details | 1.0 | no | |||||||||||
|
||||||||||||||
reduce(Function fn, Object initialValue) : Object
reduce runs a function on every item in the resultset and collects the results returned. reduce executes the callback function
once for each element present in the resultset, receiving four arguments: - the initial value (or value from the previous
callback call), - the value of the current row of the resultset, - the current index, - an array representing the resultset
over which iteration is occurring.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
reduceRight(Function fn, Object initialValue) : Object
reduceRight runs a function on every item in the resultset and collects the results returned, but in reverse order starting
with the last element of the recordset. reduceRight executes the callback function once for each element present in the resultset,
excluding holes in the array, receiving four arguments: - the initial value (or value from the previous callback call), -
the value of the current row of the resultset, - the current index, - an array representing the resultset over which iteration
is occurring.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
singleRowAsArray() :
void
An alias of the Jaxer.DB.ResultSet.prototype.singleRowAsArray method
|
Show Details | 1.0 | no | |||||||||||
singleRowAsArray(Number identifies) : Array
This contains the requested columns from the first row of the resultSet as an array, or else it contains an empty array.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
some(Function fn) : Boolean
some runs a function against each row in the recordset while that function until returning true. returns true if the function
returns true for at least one row it could visit The function is invoked with three arguments: - the value of the current
row in the resultset, - the index of the current row in the resultset, - an array representing the resultset being traversed.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
split(Function fn) : Array<Array>
split runs a function against each row in the recordset. returns A two element array containing the recorset items for which
the function returned true as the first element and the items which returned false as the 2nd element. The function is invoked
with three arguments: - the value of the current row in the resultset, - the index of the current row in the resultset, -
an array representing the resultset being traversed.
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
toHTML([Object tableAttributes,] [Object headingAttributes,] [Object bodyAttributes]) : String
Returns a HTML table snippet containing the resultset items
|
Show Details | 1.0 | no | |||||||||||
Parameters
Returns
|
||||||||||||||
toString() : String
Returns a string representation of the resultset object
|
Show Details | 1.0 | no | |||||||||||
Returns
|
Examples
If the third column is named "account" you can get to a given cell value either through resultSet.rows [ 10 ] .account or through resultSet.rows [ 10 ] .$values [ 2 ] or through resultSet.rowsAsArrays [ 10 ] [ 2 ]