class Connection

Represents a connection between PHP and a database server.

Properties

callable[] $onConnect
callable[] $onQuery

Methods

__construct($dsn, $user = null, $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

string
getInsertId($name = null)

No description

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

No description

void
beginTransaction()

No description

void
commit()

No description

void
rollBack()

No description

query($sql, ...$params)

Generates and executes SQL query.

queryArgs($sql, array $params)

No description

preprocess($sql, ...$params)

No description

string|null
getLastQueryString()

No description

Row
fetch($sql, ...$params)

Shortcut for query()->fetch()

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

Shortcut for query()->fetchField()

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

Shortcut for query()->fetchFields()

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

Shortcut for query()->fetchPairs()

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

Shortcut for query()->fetchAll()

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

No description

Details

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

No description

Parameters

$dsn
$user
$password
array $options

at line 63
void connect()

No description

Return Value

void

at line 86
void reconnect()

No description

Return Value

void

at line 94
void disconnect()

No description

Return Value

void

at line 101
string getDsn()

No description

Return Value

string

at line 108
PDO getPdo()

No description

Return Value

PDO

at line 116
ISupplementalDriver getSupplementalDriver()

No description

Return Value

ISupplementalDriver

at line 127
string getInsertId($name = null)

No description

Parameters

$name

Return Value

string

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

No description

Parameters

$string
$type

Return Value

string

at line 158
void beginTransaction()

No description

Return Value

void

at line 165
void commit()

No description

Return Value

void

at line 172
void rollBack()

No description

Return Value

void

at line 183
ResultSet query($sql, ...$params)

Generates and executes SQL query.

Parameters

$sql
...$params

Return Value

ResultSet

at line 201
ResultSet queryArgs($sql, array $params)

No description

Parameters

$sql
array $params

Return Value

ResultSet

at line 210
preprocess($sql, ...$params)

No description

Parameters

$sql
...$params

at line 222
string|null getLastQueryString()

No description

Return Value

string|null

at line 236
Row fetch($sql, ...$params)

Shortcut for query()->fetch()

Parameters

$sql
...$params

Return Value

Row

at line 247
mixed fetchField($sql, ...$params)

Shortcut for query()->fetchField()

Parameters

$sql
...$params

Return Value

mixed

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

Shortcut for query()->fetchFields()

Parameters

$sql
...$params

Return Value

array|null

at line 269
array fetchPairs($sql, ...$params)

Shortcut for query()->fetchPairs()

Parameters

$sql
...$params

Return Value

array

at line 280
array fetchAll($sql, ...$params)

Shortcut for query()->fetchAll()

Parameters

$sql
...$params

Return Value

array

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

No description

Parameters

$value
...$params

Return Value

SqlLiteral

Traits

SmartObject