Class SS_Query
Abstract query-result class. Once again, this should be subclassed by an
actual database implementation. It will only ever be constructed by a subclass
of SS_Database. The result of a database query - an iteratable object that's
returned by DB::SS_Query
Primarily, the SS_Query class takes care of the iterator plumbing, letting
the subclasses focusing on providing the specific data-access methods that are
required: SS_Query::nextRecord(), SS_Query::numRecords() and SS_Query::seek()
-
SS_Query
implements
Iterator
Methods summary
public
array
|
#
column( string $column = null )
Return an array containing all the values from a specific column. If no
column is set, then the first will be returned
Return an array containing all the values from a specific column. If no
column is set, then the first will be returned
Parameters
Returns
array array
|
public
array
|
#
keyedColumn( )
Return an array containing all values in the leftmost column, where the keys
are the same as the values.
Return an array containing all values in the leftmost column, where the keys
are the same as the values.
Returns
array array
|
public
array
|
#
map( )
Return a map from the first column to the second column.
Return a map from the first column to the second column.
Returns
array array
|
public
array
|
#
record( )
Returns the next record in the iterator.
Returns the next record in the iterator.
Returns
array array
|
public
string
|
#
value( )
Returns the first column of the first record.
Returns the first column of the first record.
Returns
string string
|
public
|
#
table( )
Return an HTML table containing the full result-set
Return an HTML table containing the full result-set
|
public
array
|
|
public
array
|
#
current( )
Iterator function implementation. Return the current item of the
iterator.
Iterator function implementation. Return the current item of the
iterator.
Returns
array array
Implementation of
|
public
array
|
#
first( )
Iterator function implementation. Return the first item of this iterator.
Iterator function implementation. Return the first item of this iterator.
Returns
array array
|
public
integer
|
#
key( )
Iterator function implementation. Return the row number of the current
item.
Iterator function implementation. Return the row number of the current
item.
Returns
integer int
Implementation of
|
public
array
|
#
next( )
Iterator function implementation. Return the next record in the iterator.
Makes use of SS_Query::nextRecord(), takes care of the plumbing.
Iterator function implementation. Return the next record in the iterator.
Makes use of SS_Query::nextRecord(), takes care of the plumbing.
Returns
array array
Implementation of
|
public
boolean
|
#
valid( )
Iterator function implementation. Check if the iterator is pointing to a
valid item.
Iterator function implementation. Check if the iterator is pointing to a
valid item.
Returns
boolean boolean
Implementation of
|
abstract public
array
|
#
nextRecord( )
Return the next record in the query result.
Return the next record in the query result.
Returns
array array
|
abstract public
integer
|
#
numRecords( )
Return the total number of items in the query result.
Return the total number of items in the query result.
Returns
integer int
|
abstract public
array
|
#
seek( integer $rowNum )
Go to a specific row number in the query result and return the record.
Go to a specific row number in the query result and return the record.
Parameters
- $rowNum
- int $rowNum Tow number to go to.
Returns
array array
|
Magic methods summary
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-