class PDOStatementHandle (View source)

deprecated 4.13.0 Will be removed without equivalent functionality to replace it

A handle to a PDOStatement, with cached column metadata, and type conversion

Column metadata can't be fetched from a native PDOStatement after multiple calls in some DB backends, so we wrap in this handle object, which also takes care of tidying up content types to keep in line with the SilverStripe 4.4+ type expectations.

Properties

protected static $type_mapping

Mapping of PDO-reported "native types" to PHP types

Methods

public
__construct(PDOStatement $statement)

Create a new handle.

public
array
typeCorrectedFetchAll()

Fetch a record form the statement with its type data corrected Returns data as an array of maps

public
bool
closeCursor()

Closes the cursor, enabling the statement to be executed again (PDOStatement::closeCursor)

public
string
errorCode()

Fetch the SQLSTATE associated with the last operation on the statement handle (PDOStatement::errorCode)

public
array
errorInfo()

Fetch extended error information associated with the last operation on the statement handle (PDOStatement::errorInfo)

public
int
rowCount()

Returns the number of rows affected by the last SQL statement (PDOStatement::rowCount)

public
bool
execute(array $parameters)

Executes a prepared statement (PDOStatement::execute)

public
getPDOStatement()

Return the PDOStatement that this object provides a handle to

Details

__construct(PDOStatement $statement)

Create a new handle.

Parameters

PDOStatement $statement

The statement to provide a handle to

array typeCorrectedFetchAll()

Fetch a record form the statement with its type data corrected Returns data as an array of maps

Return Value

array

bool closeCursor()

Closes the cursor, enabling the statement to be executed again (PDOStatement::closeCursor)

Return Value

bool

Returns true on success

string errorCode()

Fetch the SQLSTATE associated with the last operation on the statement handle (PDOStatement::errorCode)

Return Value

string

array errorInfo()

Fetch extended error information associated with the last operation on the statement handle (PDOStatement::errorInfo)

Return Value

array

int rowCount()

Returns the number of rows affected by the last SQL statement (PDOStatement::rowCount)

Return Value

int

bool execute(array $parameters)

Executes a prepared statement (PDOStatement::execute)

Parameters

array $parameters

An array of values with as many elements as there are bound parameters in the SQL statement being executed

Return Value

bool

Returns true on success

PDOStatement getPDOStatement()

Return the PDOStatement that this object provides a handle to

Return Value

PDOStatement