class Connection implements ServerInfoAwareConnection (View source)

Properties

protected PDO $connection

The underlying PDO connection.

Methods

void
__construct(PDO $connection)

Create a new PDO connection instance.

int
exec(string $statement)

Execute an SQL statement.

Statement
prepare(string $sql)

Prepare a new SQL statement.

Result
query(string $sql)

Execute a new query against the connection.

mixed
lastInsertId(string|null $name = null)

Get the last insert ID.

Statement
createStatement(PDOStatement $stmt)

Create a new statement instance.

bool
beginTransaction()

Begin a new database transaction.

bool
commit()

Commit a database transaction.

bool
rollBack()

Rollback a database transaction.

string
quote(string $input, string $type = ParameterType::STRING)

Wrap quotes around the given input.

string
getServerVersion()

Get the server version for the connection.

PDO
getWrappedConnection()

Get the wrapped PDO connection.

Details

void __construct(PDO $connection)

Create a new PDO connection instance.

Parameters

PDO $connection

Return Value

void

int exec(string $statement)

Execute an SQL statement.

Parameters

string $statement

Return Value

int

Statement prepare(string $sql)

Prepare a new SQL statement.

Parameters

string $sql

Return Value

Statement

Exceptions

Exception

Result query(string $sql)

Execute a new query against the connection.

Parameters

string $sql

Return Value

Result

mixed lastInsertId(string|null $name = null)

Get the last insert ID.

Parameters

string|null $name

Return Value

mixed

Exceptions

Exception

protected Statement createStatement(PDOStatement $stmt)

Create a new statement instance.

Parameters

PDOStatement $stmt

Return Value

Statement

bool beginTransaction()

Begin a new database transaction.

Return Value

bool

bool commit()

Commit a database transaction.

Return Value

bool

bool rollBack()

Rollback a database transaction.

Return Value

bool

string quote(string $input, string $type = ParameterType::STRING)

Wrap quotes around the given input.

Parameters

string $input
string $type

Return Value

string

string getServerVersion()

Get the server version for the connection.

Return Value

string

PDO getWrappedConnection()

Get the wrapped PDO connection.

Return Value

PDO