class Connection

Represents a connection between PHP and a database server.

Properties

$onConnect
$onQuery

Methods

__construct(string $dsn, string|null $user = null, string|null $password = null, array $options = [], Configuration $configuration = new Configuration())

No description

void
connect()

No description

void
reconnect()

No description

void
disconnect()

No description

string
getDsn()

No description

PDO
getPdo()

deprecated use getDriver()->getPdo()

getDriver()

No description

getSupplementalDriver() deprecated

No description

getReflection()

No description

never
setRowNormalizer() deprecated

No description

string
getInsertId(string|null $sequence = null)

No description

string
quote(string $string)

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

table(string $table)

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 34
__construct(string $dsn, string|null $user = null, string|null $password = null, array $options = [], Configuration $configuration = new Configuration())

No description

Parameters

string $dsn
string|null $user
string|null $password
array $options
Configuration $configuration

at line 49
void connect()

No description

Return Value

void

at line 70
void reconnect()

No description

Return Value

void

at line 77
void disconnect()

No description

Return Value

void

at line 83
string getDsn()

No description

Return Value

string

at line 90
PDO getPdo()

deprecated use getDriver()->getPdo()

Return Value

PDO

at line 97
Driver getDriver()

No description

Return Value

Driver

at line 105
Driver getSupplementalDriver() deprecated

deprecated use getDriver()

No description

Return Value

Driver

at line 113
Reflection getReflection()

No description

Return Value

Reflection

at line 120
never setRowNormalizer() deprecated

deprecated use Configuration::setRowNormalizer()

No description

Return Value

never

at line 126
string getInsertId(string|null $sequence = null)

No description

Parameters

string|null $sequence

Return Value

string

at line 133
string quote(string $string)

No description

Parameters

string $string

Return Value

string

at line 140
void beginTransaction()

No description

Return Value

void

at line 150
void commit()

No description

Return Value

void

at line 160
void rollBack()

No description

Return Value

void

at line 170
mixed transaction(callable $callback)

No description

Parameters

callable $callback

Return Value

mixed

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

Generates and executes SQL query.

Parameters

string $sql
...$params

Return Value

ResultSet

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

deprecated use query()

No description

Parameters

string $sql
array $params

Return Value

ResultSet

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

No description

Parameters

string $sql
...$params

Return Value

array

at line 237
string|null getLastQueryString()

No description

Return Value

string|null

at line 243
Selection table(string $table)

No description

Parameters

string $table

Return Value

Selection

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

Shortcut for query()->fetch()

Parameters

string $sql
...$params

Return Value

Row|null

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

Shortcut for query()->fetchField()

Parameters

string $sql
...$params

Return Value

mixed

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

Shortcut for query()->fetchFields()

Parameters

string $sql
...$params

Return Value

array|null

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

Shortcut for query()->fetchPairs()

Parameters

string $sql
...$params

Return Value

array

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

Shortcut for query()->fetchAll()

Parameters

string $sql
...$params

Return Value

array

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

No description

Parameters

string $value
...$params

Return Value

SqlLiteral