class Connection

Represents a connection between PHP and a database server.

Properties

$onConnect
$onQuery

Methods

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

No description

void
connect()

No description

void
reconnect()

No description

void
disconnect()

No description

string
getDsn()

No description

PDO
getPdo()

No description

getDriver()

No description

getSupplementalDriver() deprecated

No description

setRowNormalizer(callable|null $normalizer)

No description

string
getInsertId(string $sequence = null)

No description

string
quote(string $string, int $type = PDO::PARAM_STR)

No description

void
beginTransaction()

No description

void
commit()

No description

void
rollBack()

No description

mixed
transaction(callable $callback)

No description

query(string $sql, ...$params)

Generates and executes SQL query.

queryArgs(string $sql, array $params) deprecated

No description

array
preprocess(string $sql, ...$params)

No description

string|null
getLastQueryString()

No description

Row|null
fetch(string $sql, ...$params)

Shortcut for query()->fetch()

mixed
fetchField(string $sql, ...$params)

Shortcut for query()->fetchField()

array|null
fetchFields(string $sql, ...$params)

Shortcut for query()->fetchFields()

array
fetchPairs(string $sql, ...$params)

Shortcut for query()->fetchPairs()

array
fetchAll(string $sql, ...$params)

Shortcut for query()->fetchAll()

static SqlLiteral
literal(string $value, ...$params)

No description

Details

at line 56
__construct(string $dsn, string $user = null, string $password = null, array $options = null)

No description

Parameters

string $dsn
string $user
string $password
array $options

at line 67
void connect()

No description

Return Value

void

at line 90
void reconnect()

No description

Return Value

void

at line 97
void disconnect()

No description

Return Value

void

at line 103
string getDsn()

No description

Return Value

string

at line 109
PDO getPdo()

No description

Return Value

PDO

at line 116
Driver getDriver()

No description

Return Value

Driver

at line 124
Driver getSupplementalDriver() deprecated

deprecated use getDriver()

No description

Return Value

Driver

at line 131
Connection setRowNormalizer(callable|null $normalizer)

No description

Parameters

callable|null $normalizer

Return Value

Connection

at line 138
string getInsertId(string $sequence = null)

No description

Parameters

string $sequence

Return Value

string

at line 149
string quote(string $string, int $type = PDO::PARAM_STR)

No description

Parameters

string $string
int $type

Return Value

string

at line 159
void beginTransaction()

No description

Return Value

void

at line 169
void commit()

No description

Return Value

void

at line 179
void rollBack()

No description

Return Value

void

at line 192
mixed transaction(callable $callback)

No description

Parameters

callable $callback

Return Value

mixed

at line 222
ResultSet query(string $sql, ...$params)

Generates and executes SQL query.

Parameters

string $sql
...$params

Return Value

ResultSet

at line 237
ResultSet queryArgs(string $sql, array $params) deprecated

deprecated use query()

No description

Parameters

string $sql
array $params

Return Value

ResultSet

at line 247
array preprocess(string $sql, ...$params)

No description

Parameters

string $sql
...$params

Return Value

array

at line 256
string|null getLastQueryString()

No description

Return Value

string|null

at line 269
Row|null fetch(string $sql, ...$params)

Shortcut for query()->fetch()

Parameters

string $sql
...$params

Return Value

Row|null

at line 280
mixed fetchField(string $sql, ...$params)

Shortcut for query()->fetchField()

Parameters

string $sql
...$params

Return Value

mixed

at line 290
array|null fetchFields(string $sql, ...$params)

Shortcut for query()->fetchFields()

Parameters

string $sql
...$params

Return Value

array|null

at line 300
array fetchPairs(string $sql, ...$params)

Shortcut for query()->fetchPairs()

Parameters

string $sql
...$params

Return Value

array

at line 310
array fetchAll(string $sql, ...$params)

Shortcut for query()->fetchAll()

Parameters

string $sql
...$params

Return Value

array

at line 316
static SqlLiteral literal(string $value, ...$params)

No description

Parameters

string $value
...$params

Return Value

SqlLiteral

Traits

Strict class for better experience.