class MySQLQuery extends Query (View source)

A result-set from a MySQL database (using MySQLiConnector) Note that this class is only used for the results of non-prepared statements

Properties

protected mixed $handle

The internal MySQL handle that points to the result set.

protected $columns

Metadata about the columns of this query

Methods

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

from  Query
public
array
keyedColumn()

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

from  Query
public
array
map()

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

from  Query
public
array
record()

Returns the first record in the result

from  Query
public
string
value()

Returns the first column of the first record.

from  Query
public
string
table()

Return an HTML table containing the full result-set

from  Query
public
getIterator()

Return the next record in the query result.

public
int
numRecords()

Return the total number of items in the query result.

public
__construct(MySQLiConnector $database, mixed $handle)

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

public
__destruct()

No description

public
void
rewind()

Rewind to the first row

Details

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

array keyedColumn()

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

Return Value

array

array map()

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

Return Value

array

array record()

Returns the first record in the result

Return Value

array

string value()

Returns the first column of the first record.

Return Value

string

string table()

Return an HTML table containing the full result-set

Return Value

string

Traversable getIterator()

Return the next record in the query result.

Return Value

Traversable

int numRecords()

Return the total number of items in the query result.

Return Value

int

__construct(MySQLiConnector $database, mixed $handle)

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

Parameters

MySQLiConnector $database

The database object that created this query.

mixed $handle

the internal mysql handle that is points to the resultset. Non-mysqli_result values could be given for non-select queries (e.g. true)

__destruct()

No description

void rewind()

Rewind to the first row

Return Value

void