class MySQLStatement extends Query (View source)

Provides a record-view for mysqli prepared statements

By default streams unbuffered data, but seek(), rewind(), or numRecords() will force the statement to buffer itself and sacrifice any potential performance benefit.

Properties

protected deprecated array $currentRecord

The current record in the iterator.

from  Query
protected deprecated int $rowNum

The number of the current row in the iterator.

from  Query
protected deprecated bool $queryHasBegun

Flag to keep track of whether iteration has begun, to prevent unnecessary seeks

from  Query
protected mysqli_stmt $statement

The related mysqli statement object if generated using a prepared query

protected mysqli_result $metadata

Metadata result for this statement

protected bool $bound

Is the statement bound to the current resultset?

protected array $columns

List of column names

protected array $types

Map of column types, keyed by column name

protected array $boundValues

List of bound variables in the current row

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 next record in the iterator.

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
void
rewind() deprecated

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

from  Query
public
array
current() deprecated

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

from  Query
public
array
first() deprecated

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

from  Query
public
int
key() deprecated

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

from  Query
public
array
next() deprecated

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

from  Query
public
bool
valid() deprecated

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

from  Query
public
array
nextRecord() deprecated

No description

public
int
numRecords()

Return the total number of items in the query result.

public
array
seek($row) deprecated

No description

protected
bind()

Binds this statement to the variables

public
__construct(mysqli_stmt $statement, mysqli_result $metadata)

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

public
__destruct()

No description

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 next record in the iterator.

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

void rewind() deprecated

deprecated 4.13.0 Will be replaced by getIterator() in CMS 5

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

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

Return Value

void

array current() deprecated

deprecated 4.13.0 Will be replaced by getIterator() in CMS 5

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

Return Value

array

array first() deprecated

deprecated 4.13.0 Will be replaced by getIterator() in CMS 5

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

Return Value

array

int key() deprecated

deprecated 4.13.0 Will be replaced by getIterator() in CMS 5

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

Return Value

int

array next() deprecated

deprecated 4.13.0 Will be replaced by getIterator() in CMS 5

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

Makes use of nextRecord(), takes care of the plumbing.

Return Value

array

bool valid() deprecated

deprecated 4.13.0 Will be removed without equivalent functionality to replace it

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

Return Value

bool

array nextRecord() deprecated

deprecated 4.13.0 Will be replaced by getIterator() in CMS 5

No description

Return Value

array

int numRecords()

Return the total number of items in the query result.

Return Value

int

array seek($row) deprecated

deprecated 4.13.0 Will be replaced by getIterator() in CMS 5

No description

Parameters

$row

Return Value

array

protected bind()

Binds this statement to the variables

__construct(mysqli_stmt $statement, mysqli_result $metadata)

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

Parameters

mysqli_stmt $statement

The related statement, if present

mysqli_result $metadata

The metadata for this statement

__destruct()

No description