PdoDatabaseDriver
final class PdoDatabaseDriver implements DatabaseDriverInterface (View source)
Provides SQL execution and identifier handling for generic PDO-backed connections.
Traits
Shares value escaping adapters that delegate SQL literal quoting to the active connection.
Shares nested transaction bookkeeping while issuing physical boundaries only for the outermost scope.
Methods
Converts scalar values to SQL literals and delegates string escaping to the consuming driver.
Escapes the wildcard and escape characters used by LIKE expressions before a value is bound or quoted.
Escapes the supplied value or identifier for safe inclusion in driver-generated SQL.
Disables transaction entry points for the consuming connection.
Controls whether a failed transaction keeps the connection in failed status for later transaction groups.
Starts a managed transaction group, optionally forcing rollback during completion for test mode.
Commits a successful group or rolls it back after a recorded failure.
Reports whether the current transaction group has remained successful.
Reports whether this connection has one or more managed transaction scopes open.
Enters a transaction scope, issuing a physical BEGIN only for the outermost scope.
Leaves a transaction scope, issuing a physical commit only when the outermost scope completes.
Leaves a transaction scope, issuing a physical rollback only when the outermost scope completes.
Marks the current transaction group failed so completion rolls it back.
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.
Initializes this PdoDatabaseDriver 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.
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.
Provides this part of the database contract while preserving the object's current state and driver semantics.
Determines whether a table exists for the connected PDO database dialect.
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.
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.
Provides this part of the database contract while preserving the object's current state and driver semantics.
Details
escape
string
escape(mixed $value)
Converts scalar values to SQL literals and delegates string escaping to the consuming driver.
escape_like_str
string
escape_like_str(string $value)
Escapes the wildcard and escape characters used by LIKE expressions before a value is bound or quoted.
escape_str
string
escape_str(string $value, bool $like = false)
Escapes the supplied value or identifier for safe inclusion in driver-generated SQL.
trans_off
void
trans_off()
Disables transaction entry points for the consuming connection.
trans_strict
void
trans_strict(bool $mode = true)
Controls whether a failed transaction keeps the connection in failed status for later transaction groups.
trans_start
bool
trans_start(bool $testMode = false)
Starts a managed transaction group, optionally forcing rollback during completion for test mode.
trans_complete
bool
trans_complete()
Commits a successful group or rolls it back after a recorded failure.
trans_status
bool
trans_status()
Reports whether the current transaction group has remained successful.
trans_active
bool
trans_active()
Reports whether this connection has one or more managed transaction scopes open.
trans_begin
bool
trans_begin(bool $testMode = false)
Enters a transaction scope, issuing a physical BEGIN only for the outermost scope.
trans_commit
bool
trans_commit()
Leaves a transaction scope, issuing a physical commit only when the outermost scope completes.
trans_rollback
bool
trans_rollback()
Leaves a transaction scope, issuing a physical rollback only when the outermost scope completes.
markTransactionFailure
protected void
markTransactionFailure()
Marks the current transaction group failed so completion rolls it back.
beginTransaction
protected void
beginTransaction()
Performs the requested transaction transition on the active database connection.
commitTransaction
protected void
commitTransaction()
Performs the requested transaction transition on the active database connection.
rollbackTransaction
protected void
rollbackTransaction()
Performs the requested transaction transition on the active database connection.
__construct
__construct(PdoConnection $connection, IdentifierEscaperInterface $identifierEscaper, IdentifierProtector $identifierProtector)
Initializes this PdoDatabaseDriver with the collaborators and state required by its database contract.
initialize
bool
initialize()
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.
platform
string
platform()
Provides this part of the database contract while preserving the object's current state and driver semantics.
version
string
version()
Provides this part of the database contract while preserving the object's current state and driver semantics.
tableExists
bool
tableExists(string $table)
Determines whether a table exists for the connected PDO database dialect.
simple_query
bool
simple_query(string $sql)
Provides this part of the database contract while preserving the object's current state and driver semantics.
affected_rows
int
affected_rows()
Provides this part of the database contract while preserving the object's current state and driver semantics.
insert_id
int|string|null
insert_id()
Provides this part of the database contract while preserving the object's current state and driver semantics.
escape_identifiers
string
escape_identifiers(string $item)
Escapes the supplied value or identifier for safe inclusion in driver-generated SQL.
protect_identifiers
string
protect_identifiers(string $item, bool $prefixSingle = false, bool|null $protectIdentifiers = null, bool $fieldExists = true)
Provides this part of the database contract while preserving the object's current state and driver semantics.