PdoConnection
final class PdoConnection implements ConnectionInterface (View source)
Adapts a PDO connection to the framework connection contract with transaction and optional instrumentation.
Methods
Initializes this PdoConnection with the collaborators and state required by its database contract.
Provides this part of the database contract while preserving the object's current state and driver semantics.
Performs the requested transaction transition on the active database connection.
Performs the requested transaction transition on the active database connection.
Performs the requested transaction transition on the active database connection.
Provides this part of the database contract while preserving the object's current state and driver semantics.
Executes the callback within an atomic transaction boundary and rolls back when it fails.
Retrieves the requested value without changing the current database state.
Provides this part of the database contract while preserving the object's current state and driver semantics.
Provides this part of the database contract while preserving the object's current state and driver semantics.
Releases resources retained by this database object so they cannot be reused.
Provides this part of the database contract while preserving the object's current state and driver semantics.
Escapes the supplied value or identifier for safe inclusion in driver-generated SQL.
Executes and measures one prepared statement after opening the lazy connection.
Details
__construct
__construct(DatabaseConfig $config, DatabaseInstrumentation $instrumentation = new DatabaseInstrumentation())
Initializes this PdoConnection with the collaborators and state required by its database contract.
pdo
PDO
pdo()
Provides this part of the database contract while preserving the object's current state and driver semantics.
select
array
select(string $sql, array $bindings = [])
No description
statement
int
statement(string $sql, array $bindings = [])
No description
beginTransaction
void
beginTransaction()
Performs the requested transaction transition on the active database connection.
commit
void
commit()
Performs the requested transaction transition on the active database connection.
rollBack
void
rollBack()
Performs the requested transaction transition on the active database connection.
inTransaction
bool
inTransaction()
Provides this part of the database contract while preserving the object's current state and driver semantics.
transaction
mixed
transaction(callable $callback)
Executes the callback within an atomic transaction boundary and rolls back when it fails.
lastInsertId
int|string|null
lastInsertId()
Retrieves the requested value without changing the current database state.
affectedRows
int
affectedRows()
Provides this part of the database contract while preserving the object's current state and driver semantics.
reconnect
void
reconnect()
Provides this part of the database contract while preserving the object's current state and driver semantics.
close
void
close()
Releases resources retained by this database object so they cannot be reused.
serverVersion
string
serverVersion()
Provides this part of the database contract while preserving the object's current state and driver semantics.
escapeString
string
escapeString(string $value)
Escapes the supplied value or identifier for safe inclusion in driver-generated SQL.
execute
PDOStatement
execute(string $sql, array $bindings = [])
Executes and measures one prepared statement after opening the lazy connection.