class Connection extends PDOConnection (View source)

Methods

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

No description

int
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 $prepareString, $driverOptions = [])

Prepares a statement for execution and returns a Statement object.

query()

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

mixed
quote($value, int $type = ParameterType::STRING)

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.

Details

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

Parameters

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

Exceptions

PDOException in case of an error.

int exec(string $statement)

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

Parameters

string $statement

Return Value

int

string getServerVersion()

Returns the version number of the database server connected to.

Return Value

string

Statement prepare(string $prepareString, $driverOptions = [])

Prepares a statement for execution and returns a Statement object.

Parameters

string $prepareString
$driverOptions

Return Value

Statement

Statement query()

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

Return Value

Statement

mixed quote($value, int $type = ParameterType::STRING)

Quotes a string for use in a query.

Parameters

$value
int $type

Return Value

mixed

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.