class PDOQuery extends Query

A result-set from a PDO database.

Methods

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

from Query
array
keyedColumn()

Return an array containing all values in the leftmost column, where the keys are the same as the values.

from Query
array
map()

Return a map from the first column to the second column.

from Query
array
record()

Returns the next record in the iterator.

from Query
string
value()

Returns the first column of the first record.

from Query
string
table()

Return an HTML table containing the full result-set

from Query
void
rewind()

Iterator function implementation. Rewind the iterator to the first item and return it.

from Query
array
current()

Iterator function implementation. Return the current item of the iterator.

from Query
array
first()

Iterator function implementation. Return the first item of this iterator.

from Query
int
key()

Iterator function implementation. Return the row number of the current item.

from Query
array
next()

Iterator function implementation. Return the next record in the iterator.

from Query
bool
valid()

Iterator function implementation. Check if the iterator is pointing to a valid item.

from Query
array
nextRecord()

Return the next record in the query result.

int
numRecords()

Return the total number of items in the query result.

array
seek($row)

Go to a specific row number in the query result and return the record.

__construct(PDOStatementHandle $statement)

Hook the result-set given into a Query class, suitable for use by SilverStripe.

Details

in Query at line 61
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

Parameters

string $column

Return Value

array

in Query at line 82
array keyedColumn()

Return an array containing all values in the leftmost column, where the keys are the same as the values.

Return Value

array

in Query at line 97
array map()

Return a map from the first column to the second column.

Return Value

array

in Query at line 113
array record()

Returns the next record in the iterator.

Return Value

array

in Query at line 123
string value()

Returns the first column of the first record.

Return Value

string

in Query at line 137
string table()

Return an HTML table containing the full result-set

Return Value

string

in Query at line 173
void rewind()

Iterator function implementation. Rewind the iterator to the first item and return it.

Makes use of {@link seek()} and {@link numRecords()}, takes care of the plumbing.

Return Value

void

in Query at line 187
array current()

Iterator function implementation. Return the current item of the iterator.

Return Value

array

in Query at line 201
array first()

Iterator function implementation. Return the first item of this iterator.

Return Value

array

in Query at line 212
int key()

Iterator function implementation. Return the row number of the current item.

Return Value

int

in Query at line 223
array next()

Iterator function implementation. Return the next record in the iterator.

Makes use of {@link nextRecord()}, takes care of the plumbing.

Return Value

array

in Query at line 236
bool valid()

Iterator function implementation. Check if the iterator is pointing to a valid item.

Return Value

bool

at line 40
array nextRecord()

Return the next record in the query result.

Return Value

array

at line 35
int numRecords()

Return the total number of items in the query result.

Return Value

int

at line 29
array seek($row)

Go to a specific row number in the query result and return the record.

Parameters

$row

Return Value

array

at line 19
__construct(PDOStatementHandle $statement)

Hook the result-set given into a Query class, suitable for use by SilverStripe.

Parameters

PDOStatementHandle $statement The internal PDOStatement containing the results