PDO Interface to implement for database drivers

 Methods

Constructor/Connection method

__construct(string $dsn, \[string] $username = NULL, \[string] $password = NULL, \[array] $driver_options = array()) : void

Parameters

$dsn

string

$username

\[string]

$password

\[string]

$driver_options

\[array]

Begin a transaction

beginTransaction() : bool

Returns

bool

Commit a transaction

commit() : bool

Returns

bool

Return the current error code

errorCode() : mixed

Returns

mixed

Return information about the current error

errorInfo() : array

Returns

array

Execute an SQL statement and return the number of affected rows

exec(string $statement) : int

Parameters

$statement

string

Returns

int

Get a connection attribute for the current db driver

getAttribute(int $attribute) 
returm mixed

Parameters

$attribute

int

Check if currently in a transaction

inTransaction() : bool

Returns

bool

Returns the id of the last row inserted into the database

lastInsertId(\[string] $name = NULL) : string

Parameters

$name

\[string]

Returns

string

Prepare a statement for execution

prepare(string $statement, \[array] $driver_options = array()) : \PDOStatement

Parameters

$statement

string

$driver_options

\[array]

Returns

Executes an sql statement

query() : \PDOStatement

Returns

Quotes a string for use in a query

quote(string $string, \[int] $parameter_type = \PDO::PARAM_STRING

Parameters

$string

string

$parameter_type

\[int]

#return string

Rollback a transaction

rollback() : bool

Returns

bool

Set a connection attribute

setAttribute(int $attribute, mixed $value) : bool

Parameters

$attribute

int

$value

mixed

Returns

bool