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

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

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

IRow|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 49
__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 60
void connect()

No description

Return Value

void

at line 83
void reconnect()

No description

Return Value

void

at line 90
void disconnect()

No description

Return Value

void

at line 96
string getDsn()

No description

Return Value

string

at line 102
PDO getPdo()

No description

Return Value

PDO

at line 109
ISupplementalDriver getSupplementalDriver()

No description

Return Value

ISupplementalDriver

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

No description

Parameters

string $sequence

Return Value

string

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

No description

Parameters

string $string
int $type

Return Value

string

at line 137
void beginTransaction()

No description

Return Value

void

at line 143
void commit()

No description

Return Value

void

at line 149
void rollBack()

No description

Return Value

void

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

Generates and executes SQL query.

Parameters

string $sql
...$params

Return Value

ResultSet

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

No description

Parameters

string $sql
array $params

Return Value

ResultSet

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

No description

Parameters

string $sql
...$params

Return Value

array

[string, array]

at line 190
string|null getLastQueryString()

No description

Return Value

string|null

at line 202
IRow|null fetch(string $sql, ...$params)

Shortcut for query()->fetch()

Parameters

string $sql
...$params

Return Value

IRow|null

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

Shortcut for query()->fetchField()

Parameters

string $sql
...$params

Return Value

mixed

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

Shortcut for query()->fetchFields()

Parameters

string $sql
...$params

Return Value

array|null

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

Shortcut for query()->fetchPairs()

Parameters

string $sql
...$params

Return Value

array

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

Shortcut for query()->fetchAll()

Parameters

string $sql
...$params

Return Value

array

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

No description

Parameters

string $value
...$params

Return Value

SqlLiteral

Traits

Strict class for better experience.