MySqlConnection
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 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 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|string|null | $lockForPopping | The lock clause supported by the current physical connection generation. |
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. |
Methods
Determine if the given exception was caused by a concurrency error such as a deadlock or serialization failure.
Determine if the given exception was caused by a lost connection.
Handle an exception encountered when running a transacted statement.
Handle an exception encountered when committing a transaction.
Rollback the active database transaction.
Forget a connection after a lost transaction operation.
Execute the callback after a transaction commits.
Execute the callback after commit, or immediately when no transaction exists.
Execute the callback after a transaction rolls back.
Get the number of seconds until the given DateTime.
Get the "available at" UNIX timestamp.
If the given value is an interval, convert it to a DateTime instance.
Given a start time, format the total run time for human readability.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new PDO database connection instance.
Get the default query grammar instance.
Set the schema grammar to the default implementation.
Get the default schema grammar instance.
Set the query post processor to the default implementation.
Get the default post processor instance.
Get a schema builder instance for the connection.
Get the schema state for the connection.
Begin a fluent query against a database table.
Run a select statement and return a single result.
Run a select statement and return the first column of the first row.
Run a select statement against the database.
Run a select statement against the database.
Run a select statement against the database and return all of the result sets.
Run a select statement against the database and return a generator.
Run an insert statement against the database.
Get the connection's last insert ID.
Run an update statement against the database.
Run a delete statement against the database.
Execute an SQL statement and return the boolean result.
Run an SQL statement and get the number of rows affected.
Run a raw, unprepared query against the PDO connection.
Run a SQL statement and log its execution context.
Run a streaming SQL statement and log only its complete execution.
Create an exception containing the query and connection context.
Determine if the given database exception was caused by a unique constraint violation.
Determine if the given database exception was caused by an invalid or out of range value.
Extract the index that caused a unique constraint violation.
Log a query in the connection's query log.
Get the elapsed time in milliseconds since a given starting point.
Register a callback to be invoked when the connection queries for longer than a given amount of time.
Allow all the query duration handlers to run again, even if they have already run.
Handle a query exception.
Handle a query exception that occurred during query execution.
Reconnect to the database if the driver resources are missing.
Forget the driver resources without performing physical cleanup.
Register a hook to be run just before a database transaction is started.
Register a hook to be run just before a database query is executed.
Clear all hooks registered to run before a database query.
Begin a foreign key constraint suppression scope.
End a foreign key constraint suppression scope.
Reset all wrapper state for pool release.
Escape a value for safe SQL embedding.
Escape a binary value for safe SQL embedding.
Determine if the database connection has modified any database records.
Indicate if any records have been modified.
Set the record modification state.
Indicate that the connection should use the write connection for reads.
Resolve and record the connection role for an operation.
Invalidate the state remembered for the current physical session.
Mark the current write session's state as unknown.
Execute an internal physical-session statement.
Set the reconnect instance on the connection.
Get the database connection with its read / write type.
Get the connection name to retain when subsequent operations may write.
Get an option from the configuration options.
Get the basic connection information as an array for debugging.
Get a human-readable name for the given connection driver.
Get the default database driver name.
Get the event dispatcher used by the connection.
Run the statement to start a new transaction.
Determine whether the connection has an active physical transaction.
Set the transaction manager instance on the connection.
Get the transaction manager instance.
Set the name of the connected database.
Set the read / write type of the connection.
Set the table prefix in use by the connection.
Get the server version for the connection.
Get the connection resolver for the given driver.
Get the PDO connection to use for a select query.
Bind values to their parameters in the given statement.
Get the last inserted ID from the given PDO connection.
Get the current PDO parameter without resolving, reconnecting, or synchronizing session state.
Get the current read PDO parameter without resolving, reconnecting, or synchronizing session state.
Resolve the current write PDO without synchronizing session state.
Resolve the current read PDO without synchronizing session state.
Synchronize the desired state for a physical database session.
Replace a physical session whose state can no longer be trusted.
Set the read PDO connection configuration.
Get the lock clause supported when popping queued jobs.
Resolve the lock clause supported when popping queued jobs.
Resolve the maximum number of bindings supported by one statement.
Determine whether the configured SQL mode uses backslash escapes.
Determine if the connected database is a MariaDB database.
Normalize the server version reported by MariaDB.
Details
in
DetectsConcurrencyErrors at line 16
protected bool
causedByConcurrencyError(Throwable $e)
Determine if the given exception was caused by a concurrency error such as a deadlock or serialization failure.
in
DetectsLostConnections at line 16
protected bool
causedByLostConnection(Throwable $e)
Determine if the given exception was caused by a lost connection.
in
ManagesTransactions at line 30
mixed
transaction(Closure $callback, int $attempts = 1)
No description
in
ManagesTransactions at line 114
protected void
handleTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)
Handle an exception encountered when running a transacted statement.
in
ManagesTransactions at line 176
void
beginTransaction()
Start a new database transaction.
in
ManagesTransactions at line 214
protected void
createTransaction()
Create a transaction within the database.
in
ManagesTransactions at line 234
protected void
handleBeginTransactionException(Throwable $e)
Handle an exception from a transaction beginning.
in
ManagesTransactions at line 250
void
commit()
Commit the active database transaction.
in
ManagesTransactions at line 294
protected void
handleCommitTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)
Handle an exception encountered when committing a transaction.
in
ManagesTransactions at line 336
void
rollBack(int|null $toLevel = null)
Rollback the active database transaction.
in
ManagesTransactions at line 390
protected void
handleRollBackException(Throwable $e)
Handle an exception from a rollback.
in
ManagesTransactions at line 408
protected void
forgetLostConnection()
Forget a connection after a lost transaction operation.
in
ManagesTransactions at line 420
int
transactionLevel()
Get the number of active transactions.
in
ManagesTransactions at line 432
void
afterCommit(callable $callback)
Execute the callback after a transaction commits.
The callback belongs to this connection's open transaction stack.
in
ManagesTransactions at line 446
void
afterCommitOrNow(callable $callback)
Execute the callback after commit, or immediately when no transaction exists.
in
ManagesTransactions at line 464
void
afterRollBack(callable $callback)
Execute the callback after a transaction rolls back.
The callback belongs to this connection's open transaction stack.
in
InteractsWithTime at line 17
protected int
secondsUntil(DateInterval|DateTimeInterface|int $delay)
Get the number of seconds until the given DateTime.
in
InteractsWithTime at line 29
protected int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)
Get the "available at" UNIX timestamp.
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.
in
InteractsWithTime at line 63
protected int
currentTime()
Get the current system time as a UNIX timestamp.
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.
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
PdoConnection at line 73
__construct(PDO|Closure $pdo, string $database = '', string $tablePrefix = '', array $config = [])
Create a new PDO database connection instance.
in
Connection at line 233
void
useDefaultQueryGrammar()
Set the query grammar to the default implementation.
at line 218
protected Grammar
getDefaultQueryGrammar()
Get the default query grammar instance.
in
Connection at line 249
void
useDefaultSchemaGrammar()
Set the schema grammar to the default implementation.
at line 238
protected Grammar|null
getDefaultSchemaGrammar()
Get the default schema grammar instance.
in
Connection at line 265
void
useDefaultPostProcessor()
Set the query post processor to the default implementation.
at line 255
protected Processor
getDefaultPostProcessor()
Get the default post processor instance.
at line 226
Builder
getSchemaBuilder()
Get a schema builder instance for the connection.
at line 246
SchemaState
getSchemaState(Filesystem|null $files = null, callable|null $processFactory = null)
Get the schema state for the connection.
in
Connection at line 305
Builder
table(Closure|Builder|Builder|Relation|Expression|UnitEnum|string $table, string|null $as = null)
Begin a fluent query against a database table.
in
Connection at line 317
Builder
query()
Get a new query builder instance.
in
Connection at line 329
mixed
selectOne(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement and return a single result.
in
Connection at line 341
mixed
scalar(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement and return the first column of the first row.
in
Connection at line 361
array
selectFromWriteConnection(string $query, array $bindings = [])
Run a select statement against the database.
in
PdoConnection at line 83
array
select(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])
Run a select statement against the database.
in
PdoConnection at line 108
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.
in
PdoConnection at line 138
Generator
cursor(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])
Run a select statement against the database and return a generator.
at line 46
bool
insert(string $query, array $bindings = [], string|null $sequence = null)
Run an insert statement against the database.
at line 129
int|string
getLastInsertId(string|null $sequence = null)
Get the connection's last insert ID.
in
Connection at line 411
int
update(string $query, array $bindings = [])
Run an update statement against the database.
in
Connection at line 419
int
delete(string $query, array $bindings = [])
Run a delete statement against the database.
in
PdoConnection at line 214
bool
statement(string $query, array $bindings = [])
Execute an SQL statement and return the boolean result.
in
PdoConnection at line 234
int
affectingStatement(string $query, array $bindings = [])
Run an SQL statement and get the number of rows affected.
in
PdoConnection at line 261
bool
unprepared(string $query)
Run a raw, unprepared query against the PDO connection.
in
Connection at line 442
int|null
threadCount()
Get the number of open connections for the database.
in
Connection at line 455
array
pretend(Closure $callback)
Execute the given callback in "dry run" mode.
in
Connection at line 481
mixed
withoutPretending(Closure $callback)
Execute the given callback without "pretending".
in
Connection at line 502
protected array
withFreshQueryLog(Closure $callback)
Execute the given callback in "dry run" mode.
in
Connection at line 526
array
prepareBindings(array $bindings)
Prepare the query bindings for execution.
in
Connection at line 550
protected mixed
run(string $query, array $bindings, Closure $callback)
Run a SQL statement and log its execution context.
in
Connection at line 618
protected Generator
runStreaming(string $query, array $bindings, Closure $callback)
Run a streaming SQL statement and log only its complete execution.
in
Connection at line 689
protected mixed
runQueryCallback(string $query, array $bindings, Closure $callback)
Run a SQL statement.
in
Connection at line 713
protected QueryException
newQueryException(string $query, array $bindings, Exception $previous)
Create an exception containing the query and connection context.
at line 90
protected bool
isUniqueConstraintError(Exception $exception)
Determine if the given database exception was caused by a unique constraint violation.
at line 98
protected bool
isDataTypeError(Exception $exception)
Determine if the given database exception was caused by an invalid or out of range value.
at line 115
protected array
parseUniqueConstraintViolation(Exception $exception)
Extract the index that caused a unique constraint violation.
in
Connection at line 771
void
logQuery(string $query, array $bindings, float|null $time = null)
Log a query in the connection's query log.
in
Connection at line 812
protected float
getElapsedTime(float $start)
Get the elapsed time in milliseconds since a given starting point.
in
Connection at line 820
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.
in
Connection at line 840
void
allowQueryDurationHandlersToRunAgain()
Allow all the query duration handlers to run again, even if they have already run.
in
Connection at line 850
float
totalQueryDuration()
Get the duration of all run queries in milliseconds.
in
Connection at line 858
void
resetTotalQueryDuration()
Reset the duration of all run queries.
in
Connection at line 869
protected mixed
handleQueryException(QueryException $e, string $query, array $bindings, Closure $callback)
Handle a query exception.
in
Connection at line 889
protected mixed
tryAgainIfCausedByLostConnection(QueryException $e, string $query, array $bindings, Closure $callback)
Handle a query exception that occurred during query execution.
in
Connection at line 905
mixed
reconnect()
Reconnect to the database.
in
Connection at line 917
void
reconnectIfMissingConnection()
Reconnect to the database if the driver resources are missing.
in
Connection at line 929
final void
refreshFrom(Connection $fresh)
| internal |
Refresh the driver resources from a fresh connection.
in
Connection at line 947
void
disconnect()
Disconnect from the underlying driver resources.
in
Connection at line 975
protected void
resetTransactionState()
Reset the logical transaction state.
in
PdoConnection at line 634
protected bool
hasDriverResources()
Determine whether the connection has driver resources.
in
PdoConnection at line 684
protected void
disconnectDriverResources()
Disconnect the driver resources.
in
PdoConnection at line 676
protected void
forgetDriverResources()
Forget the driver resources without performing physical cleanup.
in
PdoConnection at line 712
protected void
replaceDriverResources(Connection $fresh)
Refresh the PDO resources from a fresh connection.
in
PdoConnection at line 749
bool
ping()
| internal |
Determine whether the already-open PDO resources are responsive.
in
PdoConnection at line 626
bool
isReusable()
| internal |
Determine whether the connection may be reused.
in
Connection at line 1032
Connection
beforeStartingTransaction(Closure $callback)
Register a hook to be run just before a database transaction is started.
in
Connection at line 1042
Connection
beforeExecuting(Closure $callback)
Register a hook to be run just before a database query is executed.
in
Connection at line 1054
void
clearBeforeExecutingCallbacks()
Clear all hooks registered to run before a database query.
Used by connection pooling to prevent callback leaks between requests.
in
Connection at line 1064
bool
beginForeignKeyConstraintSuppression()
| internal |
Begin a foreign key constraint suppression scope.
in
Connection at line 1074
void
endForeignKeyConstraintSuppression()
| internal |
End a foreign key constraint suppression scope.
at line 152
void
resetForPool()
Reset all wrapper state for pool release.
in
Connection at line 1131
int
getErrorCount()
Get the number of SQL execution errors on this connection.
Used by connection pooling to detect stale connections.
in
Connection at line 1144
void
listen(Closure $callback)
Register a database query listener with the connection.
Boot-only. Registers a listener on the worker-global event dispatcher; per-request registration persists and affects subsequent requests.
in
Connection at line 1152
protected void
fireConnectionEvent(string $event)
Fire an event for this connection.
in
Connection at line 1181
protected void
event(object $event)
Fire the given event.
in
Connection at line 1189
Expression
raw(mixed $value)
Get a new raw query expression.
in
Connection at line 1199
string
escape(mixed $value, bool $binary = false)
Escape a value for safe SQL embedding.
in
PdoConnection at line 308
protected string
escapeString(string $value)
Escape a string value for safe SQL embedding.
in
Connection at line 1239
protected string
escapeBool(bool $value)
Escape a boolean value for safe SQL embedding.
at line 72
protected string
escapeBinary(string $value)
Escape a binary value for safe SQL embedding.
in
Connection at line 1257
bool
hasModifiedRecords()
Determine if the database connection has modified any database records.
in
Connection at line 1265
void
recordsHaveBeenModified(bool $value = true)
Indicate if any records have been modified.
in
Connection at line 1275
Connection
setRecordModificationState(bool $value)
Set the record modification state.
in
Connection at line 1285
void
forgetRecordModificationState()
Reset the record modification state.
in
Connection at line 1293
Connection
useWriteConnectionWhenReading(bool $value = true)
Indicate that the connection should use the write connection for reads.
in
Connection at line 1305
protected string
resolveReadWriteType(bool $read = true)
Resolve and record the connection role for an operation.
in
PdoConnection at line 557
protected void
invalidateCurrentSessionState()
Invalidate the state remembered for the current physical session.
in
PdoConnection at line 567
void
markCurrentSessionStateUnknown()
| internal |
Mark the current write session's state as unknown.
in
PdoConnection at line 584
void
executeSessionStatement(string $sql)
| internal |
Execute an internal physical-session statement.
in
Connection at line 1349
Connection
setReconnector(callable $reconnector)
Set the reconnect instance on the connection.
in
Connection at line 1359
string|null
getName()
Get the database connection name.
in
Connection at line 1367
string|null
getNameWithReadWriteType()
Get the database connection with its read / write type.
in
Connection at line 1380
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.
in
Connection at line 1392
mixed
getConfig(string|null $option = null)
Get an option from the configuration options.
in
Connection at line 1400
protected array
getConnectionDetails()
Get the basic connection information as an array for debugging.
in
Connection at line 1419
string
getDriverName()
Get the database driver name.
at line 30
string
getDriverTitle()
Get a human-readable name for the given connection driver.
at line 38
protected string
getDefaultDriverName()
Get the default database driver name.
in
Connection at line 1440
Grammar
getQueryGrammar()
Get the query grammar used by the connection.
in
Connection at line 1448
Connection
setQueryGrammar(Grammar $grammar)
Set the query grammar used by the connection.
in
Connection at line 1458
Grammar|null
getSchemaGrammar()
Get the schema grammar used by the connection.
in
Connection at line 1466
Connection
setSchemaGrammar(Grammar $grammar)
Set the schema grammar used by the connection.
in
Connection at line 1476
Processor
getPostProcessor()
Get the query post processor used by the connection.
in
Connection at line 1484
Connection
setPostProcessor(Processor $processor)
Set the query post processor used by the connection.
in
Connection at line 1494
Dispatcher|null
getEventDispatcher()
Get the event dispatcher used by the connection.
in
Connection at line 1502
Connection
setEventDispatcher(Dispatcher $events)
Set the event dispatcher instance on the connection.
in
Connection at line 1512
void
unsetEventDispatcher()
Unset the event dispatcher for this connection.
in
PdoConnection at line 797
protected void
executeBeginTransactionStatement()
Run the statement to start a new transaction.
in
PdoConnection at line 807
protected void
createSavepoint()
Create a save point within the database.
in
PdoConnection at line 817
protected void
performCommit()
Commit the active physical transaction.
in
PdoConnection at line 840
protected void
performRollBack(int $toLevel)
Perform a rollback within the database.
in
PdoConnection at line 789
bool
inTransaction()
Determine whether the connection has an active physical transaction.
in
Connection at line 1572
Connection
setTransactionManager(DatabaseTransactionsManager $manager)
Set the transaction manager instance on the connection.
in
Connection at line 1582
DatabaseTransactionsManager|null
getTransactionManager()
Get the transaction manager instance.
in
Connection at line 1593
void
unsetTransactionManager()
Unset the transaction manager for this connection.
Tests only. A pooled connection keeps the null manager after release, so every later coroutine that borrows it fails when scheduling after-commit callbacks.
in
Connection at line 1601
bool
pretending()
Determine if the connection is in a "dry run".
in
Connection at line 1611
array
getQueryLog()
Get the connection query log.
in
Connection at line 1619
array
getRawQueryLog()
Get the connection query log with embedded bindings.
in
Connection at line 1633
void
flushQueryLog()
Clear the query log.
in
Connection at line 1641
void
enableQueryLog()
Enable the query log on the connection.
in
Connection at line 1649
void
disableQueryLog()
Disable the query log on the connection.
in
Connection at line 1657
bool
logging()
Determine whether we're logging queries.
in
Connection at line 1665
string
getDatabaseName()
Get the name of the connected database.
in
Connection at line 1673
Connection
setDatabaseName(string $database)
Set the name of the connected database.
in
Connection at line 1683
Connection
setReadWriteType(string|null $readWriteType)
Set the read / write type of the connection.
in
Connection at line 1695
protected string|null
latestReadWriteTypeUsed()
Retrieve the latest read / write type used.
in
Connection at line 1703
string
getTablePrefix()
Get the table prefix for the connection.
in
Connection at line 1711
Connection
setTablePrefix(string $prefix)
Set the table prefix in use by the connection.
in
Connection at line 1726
mixed
withoutTablePrefix(Closure $callback)
Execute the given callback without table prefix.
at line 170
string
getServerVersion()
Get the server version for the connection.
in
Connection at line 1751
static void
resolverFor(string $driver, Closure $callback)
Register a connection resolver.
Boot-only. 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.
in
Connection at line 1759
static Closure|null
getResolver(string $driver)
Get the connection resolver for the given driver.
in
PdoConnection at line 924
static void
flushState()
Flush all static state.
in
Connection at line 1776
void
__clone()
Prepare the instance for cloning.
in
PdoConnection at line 192
protected PDOStatement
prepared(PDOStatement $statement)
Configure the PDO prepared statement.
in
PdoConnection at line 206
protected PDO
getPdoForSelect(bool $useReadPdo = true)
Get the PDO connection to use for a select query.
in
PdoConnection at line 279
void
bindValues(PDOStatement $statement, array $bindings)
Bind values to their parameters in the given statement.
in
PdoConnection at line 336
protected int|string
getLastInsertIdFrom(PDO $pdo, string|null $sequence = null)
Get the last inserted ID from the given PDO connection.
in
PdoConnection at line 350
PDO
getPdo()
Get the current synchronized PDO connection.
in
PdoConnection at line 364
PDO|Closure|null
getRawPdo()
Get the current PDO parameter without resolving, reconnecting, or synchronizing session state.
in
PdoConnection at line 372
PDO
getReadPdo()
Get the current synchronized PDO connection used for reading.
in
PdoConnection at line 388
PDO|Closure|null
getRawReadPdo()
Get the current read PDO parameter without resolving, reconnecting, or synchronizing session state.
in
PdoConnection at line 396
protected PDO
resolvePdo()
Resolve the current write PDO without synchronizing session state.
in
PdoConnection at line 408
protected PDO
resolveReadPdo()
Resolve the current read PDO without synchronizing session state.
in
PdoConnection at line 426
protected PDO
synchronizeSession(PDO $pdo, bool $read)
Synchronize the desired state for a physical database session.
in
PdoConnection at line 494
protected PDO
replaceUnknownSession(bool $read)
Replace a physical session whose state can no longer be trusted.
in
PdoConnection at line 516
static protected PhysicalSessionState
physicalSessionState(PDO $pdo)
Get the state holder for a physical database session.
in
PdoConnection at line 526
static protected bool
sessionStateIsUnknown(PDO $pdo)
Determine whether a physical database session has unknown state.
in
PdoConnection at line 536
protected void
invalidateSessionState(PDO $pdo)
Invalidate the states remembered for a physical database session.
in
PdoConnection at line 547
protected void
markSessionStateUnknown(PDO $pdo)
Mark a physical database session's state as unknown.
at line 142
PdoConnection
setPdo(PDO|Closure|null $pdo)
Set the PDO connection.
in
PdoConnection at line 656
PdoConnection
setReadPdo(PDO|Closure|null $pdo)
Set the PDO connection used for reading.
in
PdoConnection at line 666
PdoConnection
setReadPdoConfig(array $config)
Set the read PDO connection configuration.
in
PdoConnection at line 878
bool|string
lockForPopping()
| internal |
Get the lock clause supported when popping queued jobs.
at line 178
protected bool|string
resolveLockForPopping()
Resolve the lock clause supported when popping queued jobs.
in
PdoConnection at line 896
int
maxBindings()
| internal |
Get the maximum number of bindings supported by one statement.
at line 210
protected int
resolveMaxBindings()
Resolve the maximum number of bindings supported by one statement.
in
PdoConnection at line 916
static void
configureSessionUsing(SessionConfigurator $configurator)
Register a database session configurator.
Boot-only. The configurator persists in a static property for the worker lifetime and runs on every subsequent synchronized PDO hand-out across all coroutines.
at line 82
bool
usesBackslashEscapes()
Determine whether the configured SQL mode uses backslash escapes.
at line 162
bool
isMaria()
Determine if the connected database is a MariaDB database.
at line 200
protected string
normalizeServerVersion(string $version)
Normalize the server version reported by MariaDB.