class MySqlConnection extends PdoConnection

Traits

Constants

READ_WRITE_TYPE_CONFIG_KEY

DEFAULT_MAX_BINDINGS

The conservative maximum number of statement bindings.

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected array $readConnectionConfig

The database connection configuration options for reading.

from  Connection
protected string $database

The name of the connected database.

from  Connection
protected string $configuredDatabase

The configured database name.

from  Connection
protected string $tablePrefix

The table prefix for the connection.

from  Connection
protected string $configuredTablePrefix

The configured table prefix.

from  Connection
protected array $config

The database connection configuration options.

from  Connection
protected null|Connection): mixed $reconnector

The reconnector instance for the connection.

from  Connection
protected bool $reconnecting

Indicates if the connection is reconnecting after a lost connection.

from  Connection
protected Closure|null $resourceReleaser

The owner notified when the current driver resources are forgotten.

from  Connection
protected Grammar $queryGrammar

The query grammar implementation.

from  Connection
protected Grammar|null $schemaGrammar

The schema grammar implementation.

from  Connection
protected Processor $postProcessor

The query post processor implementation.

from  Connection
protected Dispatcher|null $events

The event dispatcher instance.

from  Connection
protected int $transactions

The number of active transactions.

from  Connection
protected int $foreignKeyConstraintSuppressionDepth

The depth of the active foreign key constraint suppression scope.

from  Connection
protected int $sessionPinDepth

The number of operations retaining the current physical session.

from  Connection
protected DatabaseTransactionsManager|null $transactionsManager

The transaction manager instance.

from  Connection
protected bool $recordsModified

Indicates if changes have been made to the database.

from  Connection
protected bool $readOnWriteConnection

Indicates if the connection should use the write connection when reading.

from  Connection
protected null|"read"|"write" $readWriteType

The configured read / write type for derived single-role connections.

from  Connection
protected null|"read"|"write" $latestReadWriteTypeRetrieved

The last retrieved read / write type.

from  Connection
protected array<array{query: string, bindings: array, time: null|float}> $queryLog

All of the queries run against the connection.

from  Connection
protected bool $loggingQueries

Indicates whether queries are being logged.

from  Connection
protected float $totalQueryDuration

The duration of all executed queries in milliseconds.

from  Connection
protected array<array{threshold: float|int, handler: callable, has_run: bool}> $queryDurationHandlers

All of the registered query duration handlers.

from  Connection
protected bool $pretending

Indicates if the connection is in a "dry run".

from  Connection
protected Closure[] $beforeStartingTransaction

All of the callbacks that should be invoked before a transaction is started.

from  Connection
protected Closure[] $beforeExecutingCallbacks

All of the callbacks that should be invoked before a query is executed.

from  Connection
protected int $errorCount

The number of SQL execution errors on this connection.

from  Connection
static protected Closure> $resolvers

The connection resolvers.

from  Connection
protected null|PDO|PDO $pdo

The active PDO connection.

from  PdoConnection
protected null|PDO|PDO $readPdo

The active PDO connection used for reads.

from  PdoConnection
protected int $fetchMode

The default fetch mode of the connection.

from  PdoConnection
protected bool|null $supportsSkipLocked

Whether the current physical connection generation supports skipping locked rows.

from  PdoConnection
protected int|null $maxBindings

The maximum number of statement bindings supported by the current physical connection generation.

from  PdoConnection
static protected SessionConfigurator> $sessionConfigurators

The registered database session configurators.

from  PdoConnection
static protected null|PhysicalSessionState> $physicalSessionStates

The state known for each live physical database session.

from  PdoConnection
protected string|int|null $lastInsertId

The last inserted ID generated by the server.

protected bool $usingOlapWorkload

Whether an OLAP workload scope owns the current session.

Methods

bool
causedByConcurrencyError(Throwable $e)

Determine if the given exception was caused by a concurrency error such as a deadlock or serialization failure.

bool
causedByLostConnection(Throwable $e)

Determine if the given exception was caused by a lost connection.

mixed
transaction(Closure $callback, int $attempts = 1)

No description

void
handleTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)

Handle an exception encountered when running a transacted statement.

void
beginTransaction()

Start a new database transaction.

void
createTransaction()

Create a transaction within the database.

void
handleBeginTransactionException(Throwable $e)

Handle an exception from a transaction beginning.

void
commit()

Commit the active database transaction.

void
handleCommitTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)

Handle an exception encountered when committing a transaction.

void
rollBack(int|null $toLevel = null)

Rollback the active database transaction.

void
handleRollBackException(Throwable $e)

Handle an exception from a rollback.

void
forgetLostConnection()

Forget a connection after a lost transaction operation.

int
transactionLevel()

Get the number of active transactions.

bool
hasApplicableTransaction()

Determine whether this connection has a transaction that delays after-commit callbacks.

void
afterCommit(callable $callback)

Execute the callback after a transaction commits.

void
afterCommitOrNow(callable $callback)

Execute the callback after commit, or immediately when no transaction exists.

void
afterRollBack(callable $callback)

Execute the callback after a transaction rolls back.

int
secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

int
currentTime()

Get the current system time as a UNIX timestamp.

string
runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

__construct(PDO|Closure $pdo, string $database = '', string $tablePrefix = '', array $config = [])

Create a new PDO database connection instance.

void
useDefaultQueryGrammar()

Set the query grammar to the default implementation.

getDefaultQueryGrammar()

Get the default query grammar instance.

void
useDefaultSchemaGrammar()

Set the schema grammar to the default implementation.

Grammar|null
getDefaultSchemaGrammar()

Get the default schema grammar instance.

void
useDefaultPostProcessor()

Set the query post processor to the default implementation.

getDefaultPostProcessor()

Get the default post processor instance.

getSchemaBuilder()

Get a schema builder instance for the connection.

getSchemaState(Filesystem|null $files = null, callable|null $processFactory = null)

Get the schema state for the connection.

table(Closure|Builder|Builder|Relation|Expression|UnitEnum|string $table, string|null $as = null)

Begin a fluent query against a database table.

query()

Get a new query builder instance.

mixed
selectOne(string $query, array $bindings = [], bool $useReadPdo = true)

Run a select statement and return a single result.

mixed
scalar(string $query, array $bindings = [], bool $useReadPdo = true)

Run a select statement and return the first column of the first row.

array
selectFromWriteConnection(string $query, array $bindings = [])

Run a select statement against the database.

array
select(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])

Run a select statement against the database.

array
selectResultSets(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])

Run a select statement against the database and return all of the result sets.

cursor(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])

Run a select statement against the database and return a generator.

bool
insert(string $query, array $bindings = [], string|null $sequence = null)

Run an insert statement against the database.

int|string
getLastInsertId(string|null $sequence = null)

Get the connection's last insert ID.

int
update(string $query, array $bindings = [])

Run an update statement against the database.

int
delete(string $query, array $bindings = [])

Run a delete statement against the database.

bool
statement(string $query, array $bindings = [])

Execute an SQL statement and return the boolean result.

int
affectingStatement(string $query, array $bindings = [])

Run an SQL statement and get the number of rows affected.

bool
unprepared(string $query)

Run a raw, unprepared query against the PDO connection.

int|null
threadCount()

Get the number of open connections for the database.

array
pretend(Closure $callback)

Execute the given callback in "dry run" mode.

mixed
withoutPretending(Closure $callback)

Execute the given callback without "pretending".

array
withFreshQueryLog(Closure $callback)

Execute the given callback in "dry run" mode.

array
prepareBindings(array $bindings)

Prepare the query bindings for execution.

mixed
run(string $query, array $bindings, Closure $callback)

Run a SQL statement and log its execution context.

runStreaming(string $query, array $bindings, Closure $callback)

Run a streaming SQL statement and log only its complete execution.

mixed
runQueryCallback(string $query, array $bindings, Closure $callback)

Run a SQL statement.

newQueryException(string $query, array $bindings, Exception $previous)

Create an exception containing the query and connection context.

bool
isUniqueConstraintError(Exception $exception)

Determine if the given database exception was caused by a unique constraint violation.

bool
isDataTypeError(Exception $exception)

Determine if the given database exception was caused by an invalid or out of range value.

bool
isDriverError(Exception $exception)

Determine if the given exception was thrown by the database driver.

array
parseUniqueConstraintViolation(Exception $exception)

Extract the index that caused a unique constraint violation.

void
logQuery(string $query, array $bindings, float|null $time = null)

Log a query in the connection's query log.

float
getElapsedTime(float $start)

Get the elapsed time in milliseconds since a given starting point.

void
whenQueryingForLongerThan(DateTimeInterface|CarbonInterval|float|int $threshold, callable $handler)

Register a callback to be invoked when the connection queries for longer than a given amount of time.

void
allowQueryDurationHandlersToRunAgain()

Allow all the query duration handlers to run again, even if they have already run.

float
totalQueryDuration()

Get the duration of all run queries in milliseconds.

void
resetTotalQueryDuration()

Reset the duration of all run queries.

mixed
handleQueryException(QueryException $e, string $query, array $bindings, Closure $callback)

Handle a query exception.

mixed
tryAgainIfCausedByLostConnection(QueryException $e, string $query, array $bindings, Closure $callback)

Handle a query exception that occurred during query execution.

mixed
reconnect()

Reconnect to the database, preserving an active OLAP workload.

void
reconnectIfMissingConnection()

Reconnect to the database if the driver resources are missing.

void
reconnectForQuery(string $query, array $bindings)

Reconnect for the given query, reporting driver failures as query failures.

void
refreshFrom(Connection $fresh)

Refresh the driver resources from a fresh connection.

void
disconnect()

Disconnect from the underlying driver resources.

void
resetTransactionState()

Reset the logical transaction state.

bool
hasDriverResources()

Determine whether the connection has driver resources.

void
disconnectDriverResources()

Disconnect the driver resources.

void
forgetDriverResources()

Forget the driver resources without performing physical cleanup.

void
notifyResourceReleaser()

Notify the resource owner that the current driver resources were forgotten.

void
replaceDriverResources(Connection $fresh)

Refresh the PDO resources from a fresh connection.

bool
ping()

Determine whether the already-open PDO resources are responsive.

bool
isReusable()

Determine whether the connection may be reused.

beforeStartingTransaction(Closure $callback)

Register a hook to be run just before a database transaction is started.

beforeExecuting(Closure $callback)

Register a hook to be run just before a database query is executed.

void
clearBeforeExecutingCallbacks()

Clear all hooks registered to run before a database query.

mixed
withPinnedSession(Closure $callback)

Retain the physical database session for the duration of the callback.

bool
hasPinnedSession()

Determine whether an operation requires the current physical session.

bool
beginForeignKeyConstraintSuppression()

Begin a foreign key constraint suppression scope.

void
endForeignKeyConstraintSuppression()

End a foreign key constraint suppression scope.

void
resetForPool()

Reset all wrapper state for pool release.

int
getErrorCount()

Get the number of SQL execution errors on this connection.

void
listen(Closure $callback)

Register a database query listener with the connection.

void
fireConnectionEvent(string $event)

Fire an event for this connection.

void
event(object $event)

Fire the given event.

raw(mixed $value)

Get a new raw query expression.

string
escape(mixed $value, bool $binary = false)

Escape a value for safe SQL embedding.

string
escapeString(string $value)

Escape a string value for safe SQL embedding.

string
escapeBool(bool $value)

Escape a boolean value for safe SQL embedding.

string
escapeBinary(string $value)

Escape a binary value for safe SQL embedding.

bool
hasModifiedRecords()

Determine if the database connection has modified any database records.

void
recordsHaveBeenModified(bool $value = true)

Indicate if any records have been modified.

setRecordModificationState(bool $value)

Set the record modification state.

void
forgetRecordModificationState()

Reset the record modification state.

useWriteConnectionWhenReading(bool $value = true)

Indicate that the connection should use the write connection for reads.

mixed
usingWritePdo(Closure $callback)

Execute the given callback using the write connection for reads.

string
resolveReadWriteType(bool $read = true)

Resolve and record the connection role for an operation.

void
markCurrentSessionStateUnknown()

Mark the current write session's state as unknown.

void
executeSessionStatement(string $sql)

Execute an internal physical-session statement.

setReconnector(callable $reconnector)

Set the reconnect instance on the connection.

void
setResourceReleaser(Closure $callback)

Set the resource owner's callback for forgotten driver resources.

void
detachLeasedResources()

Stop notifying the pool and restart error tracking once a leased physical connection is returned.

string|null
getName()

Get the database connection name.

string|null
getNameWithReadWriteType()

Get the database connection with its read / write type.

string|null
getWritableName()

Get the connection name to retain when subsequent operations may write.

mixed
getConfig(string|null $option = null)

Get an option from the configuration options.

array
getConnectionDetails()

Get the basic connection information as an array for debugging.

string
getDriverName()

Get the database driver name.

string
getDriverTitle()

Get a human-readable name for the given connection driver.

string
getDefaultDriverName()

Get the default database driver name.

getQueryGrammar()

Get the query grammar used by the connection.

setQueryGrammar(Grammar $grammar)

Set the query grammar used by the connection.

Grammar|null
getSchemaGrammar()

Get the schema grammar used by the connection.

setSchemaGrammar(Grammar $grammar)

Set the schema grammar used by the connection.

getPostProcessor()

Get the query post processor used by the connection.

setPostProcessor(Processor $processor)

Set the query post processor used by the connection.

Dispatcher|null
getEventDispatcher()

Get the event dispatcher used by the connection.

setEventDispatcher(Dispatcher $events)

Set the event dispatcher instance on the connection.

void
unsetEventDispatcher()

Unset the event dispatcher for this connection.

void
executeBeginTransactionStatement()

Run the statement to start a new transaction.

void
createSavepoint()

Create a save point within the database.

void
performCommit()

Commit the active physical transaction.

void
performRollBack(int $toLevel)

Perform a rollback within the database.

bool
inTransaction()

Determine whether the connection has an active physical transaction.

bool
hasPhysicalTransaction()

Determine whether either open PDO handle has an active transaction.

setTransactionManager(DatabaseTransactionsManager $manager)

Set the transaction manager instance on the connection.

getTransactionManager()

Get the transaction manager instance.

void
unsetTransactionManager()

Unset the transaction manager for this connection.

bool
pretending()

Determine if the connection is in a "dry run".

array
getQueryLog()

Get the connection query log.

array
getRawQueryLog()

Get the connection query log with embedded bindings.

void
flushQueryLog()

Clear the query log.

void
enableQueryLog()

Enable the query log on the connection.

void
disableQueryLog()

Disable the query log on the connection.

bool
logging()

Determine whether we're logging queries.

string
getDatabaseName()

Get the name of the connected database.

setDatabaseName(string $database)

Set the name of the connected database.

setReadWriteType(string|null $readWriteType)

Set the read / write type of the connection.

string|null
latestReadWriteTypeUsed()

Retrieve the latest read / write type used.

string
getTablePrefix()

Get the table prefix for the connection.

setTablePrefix(string $prefix)

Set the table prefix in use by the connection.

mixed
withoutTablePrefix(Closure $callback)

Execute the given callback without table prefix.

string
getServerVersion()

Get the server version for the connection.

string
getLastCommitId()

Get the ID of the last committed transaction.

string
mergeCommitIds(array $values)

Calculate the commit ID for a set of commit IDs that includes all of them.

bool
hasCommitId(string $value, int $wait = 0)

Determine if the given commit ID has been applied.

bool
supportsSkipLocked()

Determine whether the server supports skipping locked rows.

static void
resolverFor(string $driver, Closure $callback)

Register a connection resolver.

static Closure|null
getResolver(string $driver)

Get the connection resolver for the given driver.

static void
flushState()

Flush all static state.

void
__clone()

Prepare the instance for cloning.

prepared(PDOStatement $statement)

Configure the PDO prepared statement.

PDO
getPdoForSelect(bool $useReadPdo = true)

Get the PDO connection to use for a select query.

void
bindValues(PDOStatement $statement, array $bindings)

Bind values to their parameters in the given statement.

int|string
getLastInsertIdFrom(PDO $pdo, string|null $sequence = null)

Get the last inserted ID from the given PDO connection.

PDO
getPdo()

Get the current synchronized PDO connection.

PDO|Closure|null
getRawPdo()

Get the current PDO parameter without resolving, reconnecting, or synchronizing session state.

PDO
getReadPdo()

Get the current synchronized PDO connection used for reading.

PDO|Closure|null
getRawReadPdo()

Get the current read PDO parameter without resolving, reconnecting, or synchronizing session state.

PDO
resolvePdo()

Resolve the current write PDO without synchronizing session state.

PDO
resolveReadPdo()

Resolve the current read PDO without synchronizing session state.

PDO
resolveRawPdo(bool $read = false)

Resolve a physical handle without applying caller-specific session state.

void
attachPdoResources(PdoConnection $source)

Adopt resolved handles and endpoint metadata without changing caller state.

void
detachPdoResources(Closure $pdo, Closure|null $readPdo)

Restore lazy resolvers after returning the physical resources to their owner.

PDO
synchronizeSession(bool $read)

Synchronize the desired state for a physical database session.

PDO
replaceUnknownSession(bool $read)

Replace a physical session whose state can no longer be trusted.

physicalSessionState(PDO $pdo)

Get the state holder for a physical database session.

static bool
sessionStateIsUnknown(PDO $pdo)

Determine whether a physical database session has unknown state.

void
invalidateSessionState(PDO $pdo)

Invalidate the states remembered for a physical database session.

void
markSessionStateUnknown(PDO $pdo)

Mark a physical database session's state as unknown.

setPdo(PDO|Closure|null $pdo)

Set the PDO connection.

setReadPdo(PDO|Closure|null $pdo)

Set the PDO connection used for reading.

setReadPdoConfig(array $config)

Set the read PDO connection configuration.

bool
resolveSupportsSkipLocked()

Resolve whether the server supports skipping locked rows.

int
maxBindings()

Get the maximum number of bindings supported by one statement.

int
resolveMaxBindings()

Resolve the maximum number of bindings supported by one statement.

static void
configureSessionUsing(SessionConfigurator $configurator)

Register a database session configurator.

mixed
olap(Closure $callback)

Execute the given callback using OLAP workload.

void
setWorkload(string $workload)

Set the Vitess workload for the connection.

bool
usesBackslashEscapes()

Determine whether the configured SQL mode uses backslash escapes.

bool
isMaria()

Determine if the connected database is a MariaDB database.

bool
isVitess()

Determine if the connected database is a Vitess database.

string
normalizeServerVersion(string $version)

Normalize the server version reported by MariaDB.

Details

protected bool causedByConcurrencyError(Throwable $e)

Determine if the given exception was caused by a concurrency error such as a deadlock or serialization failure.

Parameters

Throwable $e

Return Value

bool

protected bool causedByLostConnection(Throwable $e)

Determine if the given exception was caused by a lost connection.

Parameters

Throwable $e

Return Value

bool

mixed transaction(Closure $callback, int $attempts = 1)

No description

Parameters

Closure $callback
int $attempts

Return Value

mixed

Exceptions

Throwable

in ManagesTransactions at line 129
protected void handleTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)

Handle an exception encountered when running a transacted statement.

Parameters

Throwable $e
int $currentAttempt
int $maxAttempts

Return Value

void

Exceptions

Throwable

in ManagesTransactions at line 177
void beginTransaction()

Start a new database transaction.

Return Value

void

Exceptions

Throwable

in ManagesTransactions at line 215
protected void createTransaction()

Create a transaction within the database.

Return Value

void

Exceptions

Throwable

in ManagesTransactions at line 235
protected void handleBeginTransactionException(Throwable $e)

Handle an exception from a transaction beginning.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

in ManagesTransactions at line 251
void commit()

Commit the active database transaction.

Return Value

void

Exceptions

Throwable

in ManagesTransactions at line 299
protected void handleCommitTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)

Handle an exception encountered when committing a transaction.

Parameters

Throwable $e
int $currentAttempt
int $maxAttempts

Return Value

void

Exceptions

Throwable

in ManagesTransactions at line 342
void rollBack(int|null $toLevel = null)

Rollback the active database transaction.

Parameters

int|null $toLevel

Return Value

void

Exceptions

Throwable

in ManagesTransactions at line 413
protected void handleRollBackException(Throwable $e)

Handle an exception from a rollback.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

in ManagesTransactions at line 433
protected void forgetLostConnection()

Forget a connection after a lost transaction operation.

Return Value

void

in ManagesTransactions at line 450
int transactionLevel()

Get the number of active transactions.

Return Value

int

in ManagesTransactions at line 460
bool hasApplicableTransaction()

Determine whether this connection has a transaction that delays after-commit callbacks.

Without a transaction manager, any open transaction counts.

Return Value

bool

in ManagesTransactions at line 476
void afterCommit(callable $callback)

Execute the callback after a transaction commits.

The callback belongs to this connection's open transaction stack.

Parameters

callable $callback

Return Value

void

Exceptions

RuntimeException

in ManagesTransactions at line 490
void afterCommitOrNow(callable $callback)

Execute the callback after commit, or immediately when no transaction exists.

Parameters

callable $callback

Return Value

void

in ManagesTransactions at line 508
void afterRollBack(callable $callback)

Execute the callback after a transaction rolls back.

The callback belongs to this connection's open transaction stack.

Parameters

callable $callback

Return Value

void

Exceptions

RuntimeException

in InteractsWithTime at line 17
protected int secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateInterval|DateTimeInterface|int $delay

Return Value

int

in InteractsWithTime at line 29
protected int availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

int

in InteractsWithTime at line 47
protected DateTimeInterface|int parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

DateTimeInterface|int

in InteractsWithTime at line 63
protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

in InteractsWithTime at line 71
protected string runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

Parameters

float $startTime
float|null $endTime

Return Value

string

in Macroable at line 30
static void macro(string $name, callable|object $macro)

Register a custom macro.

Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.

Parameters

string $name
callable|object $macro

Return Value

void

in Macroable at line 44
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 61
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 72
static void flushMacros()

Flush the existing macros.

Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.

Return Value

void

in Macroable at line 83
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 108
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in PdoConnection at line 78
__construct(PDO|Closure $pdo, string $database = '', string $tablePrefix = '', array $config = [])

Create a new PDO database connection instance.

Parameters

PDO|Closure $pdo
string $database
string $tablePrefix
array $config

in Connection at line 251
void useDefaultQueryGrammar()

Set the query grammar to the default implementation.

Return Value

void

at line 390
protected Grammar getDefaultQueryGrammar()

Get the default query grammar instance.

Return Value

Grammar

in Connection at line 267
void useDefaultSchemaGrammar()

Set the schema grammar to the default implementation.

Return Value

void

at line 410
protected Grammar|null getDefaultSchemaGrammar()

Get the default schema grammar instance.

Return Value

Grammar|null

in Connection at line 283
void useDefaultPostProcessor()

Set the query post processor to the default implementation.

Return Value

void

at line 427
protected Processor getDefaultPostProcessor()

Get the default post processor instance.

Return Value

Processor

at line 398
Builder getSchemaBuilder()

Get a schema builder instance for the connection.

Return Value

Builder

at line 418
SchemaState getSchemaState(Filesystem|null $files = null, callable|null $processFactory = null)

Get the schema state for the connection.

Parameters

Filesystem|null $files
callable|null $processFactory

Return Value

SchemaState

in Connection at line 323
Builder table(Closure|Builder|Builder|Relation|Expression|UnitEnum|string $table, string|null $as = null)

Begin a fluent query against a database table.

Parameters

Closure|Builder|Builder|Relation|Expression|UnitEnum|string $table
string|null $as

Return Value

Builder

in Connection at line 335
Builder query()

Get a new query builder instance.

Return Value

Builder

in Connection at line 347
mixed selectOne(string $query, array $bindings = [], bool $useReadPdo = true)

Run a select statement and return a single result.

Parameters

string $query
array $bindings
bool $useReadPdo

Return Value

mixed

in Connection at line 359
mixed scalar(string $query, array $bindings = [], bool $useReadPdo = true)

Run a select statement and return the first column of the first row.

Parameters

string $query
array $bindings
bool $useReadPdo

Return Value

mixed

Exceptions

MultipleColumnsSelectedException

in Connection at line 379
array selectFromWriteConnection(string $query, array $bindings = [])

Run a select statement against the database.

Parameters

string $query
array $bindings

Return Value

array

in PdoConnection at line 88
array select(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])

Run a select statement against the database.

Parameters

string $query
array $bindings
bool $useReadPdo
array $fetchUsing

Return Value

array

in PdoConnection at line 113
array selectResultSets(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])

Run a select statement against the database and return all of the result sets.

Parameters

string $query
array $bindings
bool $useReadPdo
array $fetchUsing

Return Value

array

in PdoConnection at line 143
Generator cursor(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])

Run a select statement against the database and return a generator.

Parameters

string $query
array $bindings
bool $useReadPdo
array $fetchUsing

Return Value

Generator

at line 53
bool insert(string $query, array $bindings = [], string|null $sequence = null)

Run an insert statement against the database.

Parameters

string $query
array $bindings
string|null $sequence

Return Value

bool

at line 249
int|string getLastInsertId(string|null $sequence = null)

Get the connection's last insert ID.

Parameters

string|null $sequence

Return Value

int|string

in Connection at line 429
int update(string $query, array $bindings = [])

Run an update statement against the database.

Parameters

string $query
array $bindings

Return Value

int

in Connection at line 437
int delete(string $query, array $bindings = [])

Run a delete statement against the database.

Parameters

string $query
array $bindings

Return Value

int

in PdoConnection at line 230
bool statement(string $query, array $bindings = [])

Execute an SQL statement and return the boolean result.

Parameters

string $query
array $bindings

Return Value

bool

in PdoConnection at line 250
int affectingStatement(string $query, array $bindings = [])

Run an SQL statement and get the number of rows affected.

Parameters

string $query
array $bindings

Return Value

int

in PdoConnection at line 277
bool unprepared(string $query)

Run a raw, unprepared query against the PDO connection.

Parameters

string $query

Return Value

bool

in Connection at line 460
int|null threadCount()

Get the number of open connections for the database.

Return Value

int|null

in Connection at line 473
array pretend(Closure $callback)

Execute the given callback in "dry run" mode.

Parameters

Closure $callback

Return Value

array

in Connection at line 499
mixed withoutPretending(Closure $callback)

Execute the given callback without "pretending".

Parameters

Closure $callback

Return Value

mixed

in Connection at line 520
protected array withFreshQueryLog(Closure $callback)

Execute the given callback in "dry run" mode.

Parameters

Closure $callback

Return Value

array

in Connection at line 544
array prepareBindings(array $bindings)

Prepare the query bindings for execution.

Parameters

array $bindings

Return Value

array

in Connection at line 568
protected mixed run(string $query, array $bindings, Closure $callback)

Run a SQL statement and log its execution context.

Parameters

string $query
array $bindings
Closure $callback

Return Value

mixed

Exceptions

CanceledException
QueryException

in Connection at line 646
protected Generator runStreaming(string $query, array $bindings, Closure $callback)

Run a streaming SQL statement and log only its complete execution.

Parameters

string $query
array $bindings
Closure $callback

Return Value

Generator

Exceptions

CanceledException
QueryException
StreamClosedException

in Connection at line 733
protected mixed runQueryCallback(string $query, array $bindings, Closure $callback)

Run a SQL statement.

Parameters

string $query
array $bindings
Closure $callback

Return Value

mixed

Exceptions

CanceledException
QueryException

in Connection at line 759
protected QueryException newQueryException(string $query, array $bindings, Exception $previous)

Create an exception containing the query and connection context.

Parameters

string $query
array $bindings
Exception $previous

Return Value

QueryException

at line 199
protected bool isUniqueConstraintError(Exception $exception)

Determine if the given database exception was caused by a unique constraint violation.

Parameters

Exception $exception

Return Value

bool

at line 207
protected bool isDataTypeError(Exception $exception)

Determine if the given database exception was caused by an invalid or out of range value.

Parameters

Exception $exception

Return Value

bool

in PdoConnection at line 344
protected bool isDriverError(Exception $exception)

Determine if the given exception was thrown by the database driver.

Parameters

Exception $exception

Return Value

bool

at line 235
protected array parseUniqueConstraintViolation(Exception $exception)

Extract the index that caused a unique constraint violation.

Parameters

Exception $exception

Return Value

array

in Connection at line 825
void logQuery(string $query, array $bindings, float|null $time = null)

Log a query in the connection's query log.

Parameters

string $query
array $bindings
float|null $time

Return Value

void

in Connection at line 866
protected float getElapsedTime(float $start)

Get the elapsed time in milliseconds since a given starting point.

Parameters

float $start

Return Value

float

in Connection at line 874
void whenQueryingForLongerThan(DateTimeInterface|CarbonInterval|float|int $threshold, callable $handler)

Register a callback to be invoked when the connection queries for longer than a given amount of time.

Parameters

DateTimeInterface|CarbonInterval|float|int $threshold
callable $handler

Return Value

void

in Connection at line 894
void allowQueryDurationHandlersToRunAgain()

Allow all the query duration handlers to run again, even if they have already run.

Return Value

void

in Connection at line 904
float totalQueryDuration()

Get the duration of all run queries in milliseconds.

Return Value

float

in Connection at line 912
void resetTotalQueryDuration()

Reset the duration of all run queries.

Return Value

void

in Connection at line 923
protected mixed handleQueryException(QueryException $e, string $query, array $bindings, Closure $callback)

Handle a query exception.

Parameters

QueryException $e
string $query
array $bindings
Closure $callback

Return Value

mixed

Exceptions

CanceledException
QueryException

in Connection at line 943
protected mixed tryAgainIfCausedByLostConnection(QueryException $e, string $query, array $bindings, Closure $callback)

Handle a query exception that occurred during query execution.

Parameters

QueryException $e
string $query
array $bindings
Closure $callback

Return Value

mixed

Exceptions

CanceledException
QueryException

at line 141
mixed reconnect()

Reconnect to the database, preserving an active OLAP workload.

Return Value

mixed

in Connection at line 978
void reconnectIfMissingConnection()

Reconnect to the database if the driver resources are missing.

Return Value

void

in Connection at line 993
protected void reconnectForQuery(string $query, array $bindings)

Reconnect for the given query, reporting driver failures as query failures.

Laravel reconnects lazily, so a failed connection surfaces from the query callback as a QueryException. Driver resources are established eagerly here instead.

Parameters

string $query
array $bindings

Return Value

void

Exceptions

QueryException

in Connection at line 1016
final void refreshFrom(Connection $fresh)

internal  
 

Refresh the driver resources from a fresh connection.

Parameters

Connection $fresh

Return Value

void

in Connection at line 1034
void disconnect()

Disconnect from the underlying driver resources.

Return Value

void

in Connection at line 1063
protected void resetTransactionState()

Reset the logical transaction state.

Return Value

void

in PdoConnection at line 719
protected bool hasDriverResources()

Determine whether the connection has driver resources.

Return Value

bool

in PdoConnection at line 777
protected void disconnectDriverResources()

Disconnect the driver resources.

Return Value

void

in PdoConnection at line 769
protected void forgetDriverResources()

Forget the driver resources without performing physical cleanup.

Return Value

void

in Connection at line 1092
protected void notifyResourceReleaser()

Notify the resource owner that the current driver resources were forgotten.

Return Value

void

in PdoConnection at line 815
protected void replaceDriverResources(Connection $fresh)

Refresh the PDO resources from a fresh connection.

Parameters

Connection $fresh

Return Value

void

in PdoConnection at line 858
bool ping()

internal  
 

Determine whether the already-open PDO resources are responsive.

Return Value

bool

in PdoConnection at line 711
bool isReusable()

internal  
 

Determine whether the connection may be reused.

Return Value

bool

in Connection at line 1132
Connection beforeStartingTransaction(Closure $callback)

Register a hook to be run just before a database transaction is started.

Parameters

Closure $callback

Return Value

Connection

in Connection at line 1144
Connection beforeExecuting(Closure $callback)

Register a hook to be run just before a database query is executed.

Parameters

Closure $callback

Return Value

Connection

in Connection at line 1156
void clearBeforeExecutingCallbacks()

Clear all hooks registered to run before a database query.

Used by connection pooling to prevent callback leaks between requests.

Return Value

void

in Connection at line 1169
mixed withPinnedSession(Closure $callback)

Retain the physical database session for the duration of the callback.

Parameters

Closure $callback

Return Value

mixed

in Connection at line 1186
bool hasPinnedSession()

Determine whether an operation requires the current physical session.

Drivers may extend this check to keep their physical session, for example when their own routing could send a later read to another server.

Return Value

bool

in Connection at line 1199
bool beginForeignKeyConstraintSuppression()

internal  
 

Begin a foreign key constraint suppression scope.

Return Value

bool

in Connection at line 1209
void endForeignKeyConstraintSuppression()

internal  
 

End a foreign key constraint suppression scope.

Return Value

void

at line 274
void resetForPool()

Reset all wrapper state for pool release.

Return Value

void

in Connection at line 1266
int getErrorCount()

Get the number of SQL execution errors on this connection.

Used by connection pooling to detect stale connections.

Return Value

int

in Connection at line 1279
void listen(Closure $callback)

Register a database query listener with the connection.

When the dispatcher is the application's worker-shared dispatcher, per-request registration persists and affects subsequent requests.

Parameters

Closure $callback

Return Value

void

in Connection at line 1287
protected void fireConnectionEvent(string $event)

Fire an event for this connection.

Parameters

string $event

Return Value

void

in Connection at line 1316
protected void event(object $event)

Fire the given event.

Parameters

object $event

Return Value

void

in Connection at line 1324
Expression raw(mixed $value)

Get a new raw query expression.

Parameters

mixed $value

Return Value

Expression

in Connection at line 1334
string escape(mixed $value, bool $binary = false)

Escape a value for safe SQL embedding.

Parameters

mixed $value
bool $binary

Return Value

string

Exceptions

RuntimeException

in PdoConnection at line 324
protected string escapeString(string $value)

Escape a string value for safe SQL embedding.

Parameters

string $value

Return Value

string

in Connection at line 1374
protected string escapeBool(bool $value)

Escape a boolean value for safe SQL embedding.

Parameters

bool $value

Return Value

string

at line 181
protected string escapeBinary(string $value)

Escape a binary value for safe SQL embedding.

Parameters

string $value

Return Value

string

in Connection at line 1392
bool hasModifiedRecords()

Determine if the database connection has modified any database records.

Return Value

bool

in Connection at line 1400
void recordsHaveBeenModified(bool $value = true)

Indicate if any records have been modified.

Parameters

bool $value

Return Value

void

in Connection at line 1412
Connection setRecordModificationState(bool $value)

Set the record modification state.

Parameters

bool $value

Return Value

Connection

in Connection at line 1422
void forgetRecordModificationState()

Reset the record modification state.

Return Value

void

in Connection at line 1432
Connection useWriteConnectionWhenReading(bool $value = true)

Indicate that the connection should use the write connection for reads.

Parameters

bool $value

Return Value

Connection

in Connection at line 1447
mixed usingWritePdo(Closure $callback)

Execute the given callback using the write connection for reads.

Parameters

Closure $callback

Return Value

mixed

in Connection at line 1465
protected string resolveReadWriteType(bool $read = true)

Resolve and record the connection role for an operation.

Parameters

bool $read

Return Value

string

in PdoConnection at line 654
void markCurrentSessionStateUnknown()

internal  
 

Mark the current write session's state as unknown.

Return Value

void

in PdoConnection at line 671
void executeSessionStatement(string $sql)

internal  
 

Execute an internal physical-session statement.

Parameters

string $sql

Return Value

void

in Connection at line 1504
Connection setReconnector(callable $reconnector)

Set the reconnect instance on the connection.

Parameters

callable $reconnector

Return Value

Connection

in Connection at line 1518
void setResourceReleaser(Closure $callback)

internal  
 

Set the resource owner's callback for forgotten driver resources.

Parameters

Closure $callback

Return Value

void

in Connection at line 1528
void detachLeasedResources()

internal  
 

Stop notifying the pool and restart error tracking once a leased physical connection is returned.

Return Value

void

in Connection at line 1537
string|null getName()

Get the database connection name.

Return Value

string|null

in Connection at line 1545
string|null getNameWithReadWriteType()

Get the database connection with its read / write type.

Return Value

string|null

in Connection at line 1558
string|null getWritableName()

Get the connection name to retain when subsequent operations may write.

Preserve a write alias so models reuse its transaction. Read aliases use the base connection so subsequent writes reach the primary.

Return Value

string|null

in Connection at line 1570
mixed getConfig(string|null $option = null)

Get an option from the configuration options.

Parameters

string|null $option

Return Value

mixed

in Connection at line 1578
protected array getConnectionDetails()

Get the basic connection information as an array for debugging.

Return Value

array

in Connection at line 1597
string getDriverName()

Get the database driver name.

Return Value

string

at line 37
string getDriverTitle()

Get a human-readable name for the given connection driver.

Return Value

string

at line 45
protected string getDefaultDriverName()

Get the default database driver name.

Return Value

string

in Connection at line 1618
Grammar getQueryGrammar()

Get the query grammar used by the connection.

Return Value

Grammar

in Connection at line 1628
Connection setQueryGrammar(Grammar $grammar)

Set the query grammar used by the connection.

Parameters

Grammar $grammar

Return Value

Connection

in Connection at line 1638
Grammar|null getSchemaGrammar()

Get the schema grammar used by the connection.

Return Value

Grammar|null

in Connection at line 1648
Connection setSchemaGrammar(Grammar $grammar)

Set the schema grammar used by the connection.

Parameters

Grammar $grammar

Return Value

Connection

in Connection at line 1658
Processor getPostProcessor()

Get the query post processor used by the connection.

Return Value

Processor

in Connection at line 1668
Connection setPostProcessor(Processor $processor)

Set the query post processor used by the connection.

Parameters

Processor $processor

Return Value

Connection

in Connection at line 1678
Dispatcher|null getEventDispatcher()

Get the event dispatcher used by the connection.

Return Value

Dispatcher|null

in Connection at line 1692
Connection setEventDispatcher(Dispatcher $events)

Set the event dispatcher instance on the connection.

A reusable physical connection keeps the dispatcher after release, so every later coroutine that borrows it dispatches query and transaction events to it.

Parameters

Dispatcher $events

Return Value

Connection

in Connection at line 1707
void unsetEventDispatcher()

Unset the event dispatcher for this connection.

A reusable physical connection keeps the null dispatcher after release, so every later coroutine that borrows it fires no query or transaction events.

Return Value

void

in PdoConnection at line 919
protected void executeBeginTransactionStatement()

Run the statement to start a new transaction.

Return Value

void

in PdoConnection at line 929
protected void createSavepoint()

Create a save point within the database.

Return Value

void

Exceptions

Throwable

in PdoConnection at line 939
protected void performCommit()

Commit the active physical transaction.

Return Value

void

in PdoConnection at line 962
protected void performRollBack(int $toLevel)

Perform a rollback within the database.

Parameters

int $toLevel

Return Value

void

Exceptions

Throwable

in PdoConnection at line 898
bool inTransaction()

Determine whether the connection has an active physical transaction.

Return Value

bool

in PdoConnection at line 908
bool hasPhysicalTransaction()

internal  
 

Determine whether either open PDO handle has an active transaction.

Return Value

bool

in Connection at line 1784
Connection setTransactionManager(DatabaseTransactionsManager $manager)

Set the transaction manager instance on the connection.

A reusable physical connection keeps the manager after release, so every later coroutine that borrows it schedules after-commit callbacks on it.

Parameters

DatabaseTransactionsManager $manager

Return Value

Connection

in Connection at line 1795
DatabaseTransactionsManager|null getTransactionManager()

Get the transaction manager instance.

Return Value

DatabaseTransactionsManager|null

in Connection at line 1807
void unsetTransactionManager()

Unset the transaction manager for this connection.

A reusable physical connection keeps the null manager after release, so every later coroutine that borrows it fails when scheduling after-commit callbacks.

Return Value

void

in Connection at line 1816
bool pretending()

Determine if the connection is in a "dry run".

Return Value

bool

in Connection at line 1826
array getQueryLog()

Get the connection query log.

Return Value

array

in Connection at line 1834
array getRawQueryLog()

Get the connection query log with embedded bindings.

Return Value

array

in Connection at line 1848
void flushQueryLog()

Clear the query log.

Return Value

void

in Connection at line 1856
void enableQueryLog()

Enable the query log on the connection.

Return Value

void

in Connection at line 1864
void disableQueryLog()

Disable the query log on the connection.

Return Value

void

in Connection at line 1872
bool logging()

Determine whether we're logging queries.

Return Value

bool

in Connection at line 1880
string getDatabaseName()

Get the name of the connected database.

Return Value

string

in Connection at line 1890
Connection setDatabaseName(string $database)

Set the name of the connected database.

Parameters

string $database

Return Value

Connection

in Connection at line 1902
Connection setReadWriteType(string|null $readWriteType)

Set the read / write type of the connection.

Parameters

string|null $readWriteType

Return Value

Connection

in Connection at line 1914
protected string|null latestReadWriteTypeUsed()

Retrieve the latest read / write type used.

Return Value

string|null

in Connection at line 1922
string getTablePrefix()

Get the table prefix for the connection.

Return Value

string

in Connection at line 1932
Connection setTablePrefix(string $prefix)

Set the table prefix in use by the connection.

Parameters

string $prefix

Return Value

Connection

in Connection at line 1947
mixed withoutTablePrefix(Closure $callback)

Execute the given callback without table prefix.

Parameters

Closure $callback

Return Value

mixed

at line 300
string getServerVersion()

Get the server version for the connection.

Return Value

string

at line 347
string getLastCommitId()

Get the ID of the last committed transaction.

Return Value

string

Exceptions

RuntimeException

at line 365
string mergeCommitIds(array $values)

Calculate the commit ID for a set of commit IDs that includes all of them.

Parameters

array $values

Return Value

string

Exceptions

RuntimeException

at line 378
bool hasCommitId(string $value, int $wait = 0)

Determine if the given commit ID has been applied.

Parameters

string $value
int $wait

Return Value

bool

in PdoConnection at line 998
bool supportsSkipLocked()

Determine whether the server supports skipping locked rows.

Return Value

bool

in Connection at line 2012
static void resolverFor(string $driver, Closure $callback)

Register a connection resolver.

The resolver persists in a static property for the worker lifetime and runs on every subsequent Connection construction for the given driver across all coroutines.

Parameters

string $driver
Closure $callback

Return Value

void

in Connection at line 2021
static Closure|null getResolver(string $driver)

Get the connection resolver for the given driver.

Parameters

string $driver

Return Value

Closure|null

in PdoConnection at line 1042
static void flushState()

Flush all static state.

Return Value

void

in Connection at line 2038
void __clone()

Prepare the instance for cloning.

Return Value

void

in PdoConnection at line 208
protected PDOStatement prepared(PDOStatement $statement)

Configure the PDO prepared statement.

Parameters

PDOStatement $statement

Return Value

PDOStatement

in PdoConnection at line 222
protected PDO getPdoForSelect(bool $useReadPdo = true)

Get the PDO connection to use for a select query.

Parameters

bool $useReadPdo

Return Value

PDO

in PdoConnection at line 295
void bindValues(PDOStatement $statement, array $bindings)

Bind values to their parameters in the given statement.

Parameters

PDOStatement $statement
array $bindings

Return Value

void

in PdoConnection at line 367
protected int|string getLastInsertIdFrom(PDO $pdo, string|null $sequence = null)

Get the last inserted ID from the given PDO connection.

Parameters

PDO $pdo
string|null $sequence

Return Value

int|string

in PdoConnection at line 381
PDO getPdo()

Get the current synchronized PDO connection.

Return Value

PDO

in PdoConnection at line 400
PDO|Closure|null getRawPdo()

Get the current PDO parameter without resolving, reconnecting, or synchronizing session state.

Return Value

PDO|Closure|null

in PdoConnection at line 408
PDO getReadPdo()

Get the current synchronized PDO connection used for reading.

Return Value

PDO

in PdoConnection at line 428
PDO|Closure|null getRawReadPdo()

Get the current read PDO parameter without resolving, reconnecting, or synchronizing session state.

Return Value

PDO|Closure|null

in PdoConnection at line 440
protected PDO resolvePdo()

Resolve the current write PDO without synchronizing session state.

Return Value

PDO

in PdoConnection at line 452
protected PDO resolveReadPdo()

Resolve the current read PDO without synchronizing session state.

Return Value

PDO

in PdoConnection at line 472
PDO resolveRawPdo(bool $read = false)

internal  
 

Resolve a physical handle without applying caller-specific session state.

Parameters

bool $read

Return Value

PDO

in PdoConnection at line 482
void attachPdoResources(PdoConnection $source)

internal  
 

Adopt resolved handles and endpoint metadata without changing caller state.

Parameters

PdoConnection $source

Return Value

void

in PdoConnection at line 504
void detachPdoResources(Closure $pdo, Closure|null $readPdo)

internal  
 

Restore lazy resolvers after returning the physical resources to their owner.

Parameters

Closure $pdo
Closure|null $readPdo

Return Value

void

in PdoConnection at line 519
protected PDO synchronizeSession(bool $read)

Synchronize the desired state for a physical database session.

Parameters

bool $read

Return Value

PDO

in PdoConnection at line 589
protected PDO replaceUnknownSession(bool $read)

Replace a physical session whose state can no longer be trusted.

Parameters

bool $read

Return Value

PDO

in PdoConnection at line 611
static protected PhysicalSessionState physicalSessionState(PDO $pdo)

Get the state holder for a physical database session.

Parameters

PDO $pdo

Return Value

PhysicalSessionState

in PdoConnection at line 621
static protected bool sessionStateIsUnknown(PDO $pdo)

Determine whether a physical database session has unknown state.

Parameters

PDO $pdo

Return Value

bool

in PdoConnection at line 631
protected void invalidateSessionState(PDO $pdo)

Invalidate the states remembered for a physical database session.

Parameters

PDO $pdo

Return Value

void

in PdoConnection at line 642
protected void markSessionStateUnknown(PDO $pdo)

Mark a physical database session's state as unknown.

Parameters

PDO $pdo

Return Value

void

at line 264
PdoConnection setPdo(PDO|Closure|null $pdo)

Set the PDO connection.

Parameters

PDO|Closure|null $pdo

Return Value

PdoConnection

in PdoConnection at line 746
PdoConnection setReadPdo(PDO|Closure|null $pdo)

Set the PDO connection used for reading.

Parameters

PDO|Closure|null $pdo

Return Value

PdoConnection

in PdoConnection at line 759
PdoConnection setReadPdoConfig(array $config)

Set the read PDO connection configuration.

Parameters

array $config

Return Value

PdoConnection

at line 308
protected bool resolveSupportsSkipLocked()

Resolve whether the server supports skipping locked rows.

Return Value

bool

in PdoConnection at line 1014
int maxBindings()

Get the maximum number of bindings supported by one statement.

Return Value

int

at line 337
protected int resolveMaxBindings()

Resolve the maximum number of bindings supported by one statement.

Return Value

int

in PdoConnection at line 1033
static void configureSessionUsing(SessionConfigurator $configurator)

Register a database session configurator.

The configurator persists in a static property for the worker lifetime and runs on every subsequent synchronized PDO hand-out across all coroutines.

Parameters

SessionConfigurator $configurator

Return Value

void

at line 84
mixed olap(Closure $callback)

Execute the given callback using OLAP workload.

Parameters

Closure $callback

Return Value

mixed

at line 109
protected void setWorkload(string $workload)

Set the Vitess workload for the connection.

Parameters

string $workload

Return Value

void

at line 191
bool usesBackslashEscapes()

Determine whether the configured SQL mode uses backslash escapes.

Return Value

bool

at line 284
bool isMaria()

Determine if the connected database is a MariaDB database.

Return Value

bool

at line 292
bool isVitess()

Determine if the connected database is a Vitess database.

Return Value

bool

at line 327
protected string normalizeServerVersion(string $version)

Normalize the server version reported by MariaDB.

Parameters

string $version

Return Value

string