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

string from EscapesValues
escape(mixed $value)

Converts scalar values to SQL literals and delegates string escaping to the consuming driver.

string
string from EscapesValues
escape_like_str(string $value)

Escapes the wildcard and escape characters used by LIKE expressions before a value is bound or quoted.

string
string
escape_str(string $value, bool $like = false)

Escapes the supplied value or identifier for safe inclusion in driver-generated SQL.

string

Disables transaction entry points for the consuming connection.

void
trans_strict(bool $mode = true)

Controls whether a failed transaction keeps the connection in failed status for later transaction groups.

void
trans_start(bool $testMode = false)

Starts a managed transaction group, optionally forcing rollback during completion for test mode.

bool

Commits a successful group or rolls it back after a recorded failure.

bool

Reports whether the current transaction group has remained successful.

bool

Reports whether this connection has one or more managed transaction scopes open.

bool
trans_begin(bool $testMode = false)

Enters a transaction scope, issuing a physical BEGIN only for the outermost scope.

bool

Leaves a transaction scope, issuing a physical commit only when the outermost scope completes.

bool

Leaves a transaction scope, issuing a physical rollback only when the outermost scope completes.

bool

Marks the current transaction group failed so completion rolls it back.

void
void

Performs the requested transaction transition on the active database connection.

void
void

Performs the requested transaction transition on the active database connection.

void
void

Performs the requested transaction transition on the active database connection.

void
__construct(PdoConnection $connection, IdentifierEscaperInterface $identifierEscaper, IdentifierProtector $identifierProtector)

Initializes this PdoDatabaseDriver with the collaborators and state required by its database contract.

bool

Provides this part of the database contract while preserving the object's current state and driver semantics.

bool
void

Provides this part of the database contract while preserving the object's current state and driver semantics.

void
void
close()

Releases resources retained by this database object so they cannot be reused.

void
string

Provides this part of the database contract while preserving the object's current state and driver semantics.

string
string

Provides this part of the database contract while preserving the object's current state and driver semantics.

string
bool
tableExists(string $table)

Determines whether a table exists for the connected PDO database dialect.

bool
query(string $sql, array|false $binds = false)
cursor(string $sql, array|false $binds = false)
bool
simple_query(string $sql)

Provides this part of the database contract while preserving the object's current state and driver semantics.

bool
int

Provides this part of the database contract while preserving the object's current state and driver semantics.

int
int|string|null

Provides this part of the database contract while preserving the object's current state and driver semantics.

int|string|null
string
escape_identifiers(string $item)

Escapes the supplied value or identifier for safe inclusion in driver-generated SQL.

string
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.

string

Details

escape

string escape(mixed $value)

Converts scalar values to SQL literals and delegates string escaping to the consuming driver.

Parameters

mixed $value

Return Value

string

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.

Parameters

string $value

Return Value

string

escape_str

string escape_str(string $value, bool $like = false)

Escapes the supplied value or identifier for safe inclusion in driver-generated SQL.

Parameters

string $value
bool $like

Return Value

string

trans_off

void trans_off()

Disables transaction entry points for the consuming connection.

Return Value

void

trans_strict

void trans_strict(bool $mode = true)

Controls whether a failed transaction keeps the connection in failed status for later transaction groups.

Parameters

bool $mode

Return Value

void

trans_start

bool trans_start(bool $testMode = false)

Starts a managed transaction group, optionally forcing rollback during completion for test mode.

Parameters

bool $testMode

Return Value

bool

trans_complete

bool trans_complete()

Commits a successful group or rolls it back after a recorded failure.

Return Value

bool

trans_status

bool trans_status()

Reports whether the current transaction group has remained successful.

Return Value

bool

trans_active

bool trans_active()

Reports whether this connection has one or more managed transaction scopes open.

Return Value

bool

trans_begin

bool trans_begin(bool $testMode = false)

Enters a transaction scope, issuing a physical BEGIN only for the outermost scope.

Parameters

bool $testMode

Return Value

bool

trans_commit

bool trans_commit()

Leaves a transaction scope, issuing a physical commit only when the outermost scope completes.

Return Value

bool

trans_rollback

bool trans_rollback()

Leaves a transaction scope, issuing a physical rollback only when the outermost scope completes.

Return Value

bool

markTransactionFailure

protected void markTransactionFailure()

Marks the current transaction group failed so completion rolls it back.

Return Value

void

beginTransaction

protected void beginTransaction()

Performs the requested transaction transition on the active database connection.

Return Value

void

commitTransaction

protected void commitTransaction()

Performs the requested transaction transition on the active database connection.

Return Value

void

rollbackTransaction

protected void rollbackTransaction()

Performs the requested transaction transition on the active database connection.

Return Value

void

__construct

__construct(PdoConnection $connection, IdentifierEscaperInterface $identifierEscaper, IdentifierProtector $identifierProtector)

Initializes this PdoDatabaseDriver with the collaborators and state required by its database contract.

Parameters

PdoConnection $connection
IdentifierEscaperInterface $identifierEscaper
IdentifierProtector $identifierProtector

initialize

bool initialize()

Provides this part of the database contract while preserving the object's current state and driver semantics.

Return Value

bool

reconnect

void reconnect()

Provides this part of the database contract while preserving the object's current state and driver semantics.

Return Value

void

close

void close()

Releases resources retained by this database object so they cannot be reused.

Return Value

void

platform

string platform()

Provides this part of the database contract while preserving the object's current state and driver semantics.

Return Value

string

version

string version()

Provides this part of the database contract while preserving the object's current state and driver semantics.

Return Value

string

tableExists

bool tableExists(string $table)

Determines whether a table exists for the connected PDO database dialect.

Parameters

string $table

Return Value

bool

query

DatabaseResultInterface|bool query(string $sql, array|false $binds = false)

No description

Parameters

string $sql
array|false $binds

Return Value

DatabaseResultInterface|bool

cursor

Generator cursor(string $sql, array|false $binds = false)

No description

Parameters

string $sql
array|false $binds

Return Value

Generator

simple_query

bool simple_query(string $sql)

Provides this part of the database contract while preserving the object's current state and driver semantics.

Parameters

string $sql

Return Value

bool

affected_rows

int affected_rows()

Provides this part of the database contract while preserving the object's current state and driver semantics.

Return Value

int

insert_id

int|string|null insert_id()

Provides this part of the database contract while preserving the object's current state and driver semantics.

Return Value

int|string|null

escape_identifiers

string escape_identifiers(string $item)

Escapes the supplied value or identifier for safe inclusion in driver-generated SQL.

Parameters

string $item

Return Value

string

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.

Parameters

string $item
bool $prefixSingle
bool|null $protectIdentifiers
bool $fieldExists

Return Value

string