Connection
extends PDOConnection
in package
PDO implementation of the Connection interface.
Tags
Table of Contents
- __construct() : mixed
- exec() : int
- Executes an SQL statement and return the number of affected rows.
- getServerVersion() : string
- Returns the version number of the database server connected to.
- lastInsertId() : string
- Returns the ID of the last inserted row or sequence value.
- prepare() : Statement
- Prepares a statement for execution and returns a Statement object.
- query() : Statement
- Executes an SQL statement, returning a result set as a Statement object.
- quote() : string
- Quotes a string for use in a query.
- requiresQueryForServerVersion() : bool
- Checks whether a query is required to retrieve the database server version.
Methods
__construct()
public
__construct(string $dsn[, string|null $user = null ][, string|null $password = null ][, array<string|int, mixed>|null $options = null ]) : mixed
Parameters
- $dsn : string
- $user : string|null = null
- $password : string|null = null
- $options : array<string|int, mixed>|null = null
Tags
Return values
mixed —exec()
Executes an SQL statement and return the number of affected rows.
public
exec(mixed $statement) : int
Parameters
- $statement : mixed
Return values
int —getServerVersion()
Returns the version number of the database server connected to.
public
getServerVersion() : string
Return values
string —lastInsertId()
Returns the ID of the last inserted row or sequence value.
public
lastInsertId([mixed $name = null ]) : string
Parameters
- $name : mixed = null
Return values
string —prepare()
Prepares a statement for execution and returns a Statement object.
public
prepare(mixed $prepareString[, mixed $driverOptions = array() ]) : Statement
Parameters
- $prepareString : mixed
- $driverOptions : mixed = array()
Return values
Statement —query()
Executes an SQL statement, returning a result set as a Statement object.
public
query() : Statement
Return values
Statement —quote()
Quotes a string for use in a query.
public
quote(mixed $value[, mixed $type = PDO::PARAM_STR ]) : string
Parameters
- $value : mixed
- $type : mixed = PDO::PARAM_STR
Return values
string —requiresQueryForServerVersion()
Checks whether a query is required to retrieve the database server version.
public
requiresQueryForServerVersion() : bool
Return values
bool —True if a query is required to retrieve the database server version, false otherwise.