class PDOConnection implements Connection, ServerInfoAwareConnection (View source)

PDO implementation of the Connection interface.

Used by all PDO-based drivers.

Methods

__construct(string $dsn, string|null $user = null, string|null $password = null, array|null $options = null)

No description

exec(string $statement)

Executes an SQL statement and return the number of affected rows.

string
getServerVersion()

Returns the version number of the database server connected to.

prepare(string $sql)

Prepares a statement for execution and returns a Statement object.

query(string $sql)

Executes an SQL statement, returning a result set as a Statement object.

quote(string $input)

Quotes a string for use in a query.

string
lastInsertId(string|null $name = null)

Returns the ID of the last inserted row or sequence value.

bool
requiresQueryForServerVersion()

Checks whether a query is required to retrieve the database server version.

createStatement(PDOStatement $stmt)

Creates a wrapped statement

beginTransaction()

Initiates a transaction.

commit()

Commits a transaction.

rollBack()

Rolls back the current transaction, as initiated by beginTransaction().

getWrappedConnection()

No description

Details

__construct(string $dsn, string|null $user = null, string|null $password = null, array|null $options = null)

Parameters

string $dsn
string|null $user
string|null $password
array|null $options

Exceptions

PDOException In case of an error.

exec(string $statement)

Executes an SQL statement and return the number of affected rows.

Parameters

string $statement

Exceptions

DBALException

string getServerVersion()

Returns the version number of the database server connected to.

Return Value

string

prepare(string $sql)

Prepares a statement for execution and returns a Statement object.

Parameters

string $sql

query(string $sql)

Executes an SQL statement, returning a result set as a Statement object.

Parameters

string $sql

Exceptions

DBALException

quote(string $input)

Quotes a string for use in a query.

Parameters

string $input

string lastInsertId(string|null $name = null)

Returns the ID of the last inserted row or sequence value.

Parameters

string|null $name

Return Value

string

bool requiresQueryForServerVersion()

Checks whether a query is required to retrieve the database server version.

Return Value

bool True if a query is required to retrieve the database server version, false otherwise.

protected createStatement(PDOStatement $stmt)

Creates a wrapped statement

Parameters

PDOStatement $stmt

beginTransaction()

Initiates a transaction.

Exceptions

DriverException

commit()

Commits a transaction.

Exceptions

DriverException

rollBack()

Rolls back the current transaction, as initiated by beginTransaction().

Exceptions

DriverException

getWrappedConnection()