class Connection

Represents a connection between PHP and a database server.

Properties

callable[]&(callable(Connection $onConnect
callable[]&(callable(Connection $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

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)

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 50
__construct(string $dsn, string $user = null, string $password = null, array $options = null)

Parameters

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

at line 61
void connect()

Return Value

void

at line 84
void reconnect()

Return Value

void

at line 91
void disconnect()

Return Value

void

at line 97
string getDsn()

Return Value

string

at line 103
PDO getPdo()

Return Value

PDO

at line 110
Driver getDriver()

Return Value

Driver

at line 118
Driver getSupplementalDriver() deprecated

deprecated use getDriver()

Return Value

Driver

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

Parameters

string $sequence

Return Value

string

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

Parameters

string $string
int $type

Return Value

string

at line 146
void beginTransaction()

Return Value

void

at line 152
void commit()

Return Value

void

at line 158
void rollBack()

Return Value

void

at line 167
mixed transaction(callable $callback)

Parameters

callable $callback

Return Value

mixed

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

Generates and executes SQL query.

Parameters

string $sql
...$params

Return Value

ResultSet

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

Parameters

string $sql
array $params

Return Value

ResultSet

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

Parameters

string $sql
...$params

Return Value

array [string, array]

at line 216
string|null getLastQueryString()

Return Value

string|null

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

Shortcut for query()->fetch()

Parameters

string $sql
...$params

Return Value

Row|null

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

Shortcut for query()->fetchField()

Parameters

string $sql
...$params

Return Value

mixed

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

Shortcut for query()->fetchFields()

Parameters

string $sql
...$params

Return Value

array|null

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

Shortcut for query()->fetchPairs()

Parameters

string $sql
...$params

Return Value

array

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

Shortcut for query()->fetchAll()

Parameters

string $sql
...$params

Return Value

array

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

Parameters

string $value
...$params

Return Value

SqlLiteral

Traits

SmartObject