\Query\DriversPDOInterface

Interface describing the PDO class in PHP

Summary

Methods
Constants
__construct()
beginTransaction()
commit()
errorCode()
errorInfo()
exec()
getAttribute()
getAvailableDrivers()
inTransaction()
lastInsertId()
prepare()
query()
quote()
rollBack()
setAttribute()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

__construct()

__construct(string  $dsn, string  $username, string  $password, array  $options = array()) 

Creates a PDO instance representing a connection to a database

Parameters

string $dsn
string $username
string $password
array $options

Throws

\PDOException

beginTransaction()

beginTransaction() : boolean

Initiates a transaction

Throws

\PDOException

Returns

boolean

commit()

commit() : boolean

Commits a transaction

Throws

\PDOException

Returns

boolean

errorCode()

errorCode() : mixed

Fetch the SQLSTATE associated with the last operation on the database handle

Returns

mixed

errorInfo()

errorInfo() : array

Fetch extended error information associated with the last operation on the database handle

Returns

array

exec()

exec(string  $statement) : integer

Execute an SQL statement and return the number of affected rows

Parameters

string $statement

Returns

integer

getAttribute()

getAttribute(integer  $attribute) : mixed

Retrieve a database connection attribute

Parameters

integer $attribute

Returns

mixed

getAvailableDrivers()

getAvailableDrivers() : array

Return an array of available PDO drivers

Returns

array

inTransaction()

inTransaction() : boolean

Checks if inside a transaction

Returns

boolean

lastInsertId()

lastInsertId(string  $name = NULL) : string

Returns teh ID of the last inserted row or sequence value

Parameters

string $name

Name of the sequence object from which the ID should be returned

Returns

string

prepare()

prepare(string  $statement, array  $options = NULL) : \PDOStatement

Prepares a statement for execution and returns a statement object

Parameters

string $statement
array $options

Returns

\PDOStatement

query()

query() : \PDOStatement

Executes an SQL statement, returning a result set as a PDOStatement object

Returns

\PDOStatement

quote()

quote(string  $string, integer  $parameterType = \PDO::PARAM_STR) : string|false

Quotes a string for use in a query

Parameters

string $string
integer $parameterType

Returns

string|false

rollBack()

rollBack() : boolean

Rolls back a transaction

Throws

\PDOException

Returns

boolean

setAttribute()

setAttribute(integer  $attribute, mixed  $value) : boolean

Set an attribute

Parameters

integer $attribute
mixed $value

Returns

boolean