Connection
abstract class Connection implements ConnectionInterface, NonCopyableContext
Traits
Constants
| READ_WRITE_TYPE_CONFIG_KEY |
|
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected array | $readConnectionConfig | The database connection configuration options for reading. |
|
| protected string | $database | The name of the connected database. |
|
| protected string | $configuredDatabase | The configured database name. |
|
| protected string | $tablePrefix | The table prefix for the connection. |
|
| protected string | $configuredTablePrefix | The configured table prefix. |
|
| protected array | $config | The database connection configuration options. |
|
| protected null|Connection): mixed | $reconnector | The reconnector instance for the connection. |
|
| protected bool | $reconnecting | Indicates if the connection is reconnecting after a lost connection. |
|
| protected Closure|null | $resourceReleaser | The owner notified when the current driver resources are forgotten. |
|
| protected Grammar | $queryGrammar | The query grammar implementation. |
|
| protected Grammar|null | $schemaGrammar | The schema grammar implementation. |
|
| protected Processor | $postProcessor | The query post processor implementation. |
|
| protected Dispatcher|null | $events | The event dispatcher instance. |
|
| protected int | $transactions | The number of active transactions. |
|
| protected int | $foreignKeyConstraintSuppressionDepth | The depth of the active foreign key constraint suppression scope. |
|
| protected int | $sessionPinDepth | The number of operations retaining the current physical session. |
|
| protected DatabaseTransactionsManager|null | $transactionsManager | The transaction manager instance. |
|
| protected bool | $recordsModified | Indicates if changes have been made to the database. |
|
| protected bool | $readOnWriteConnection | Indicates if the connection should use the write connection when reading. |
|
| protected null|"read"|"write" | $readWriteType | The configured read / write type for derived single-role connections. |
|
| protected null|"read"|"write" | $latestReadWriteTypeRetrieved | The last retrieved read / write type. |
|
| protected array<array{query: string, bindings: array, time: null|float}> | $queryLog | All of the queries run against the connection. |
|
| protected bool | $loggingQueries | Indicates whether queries are being logged. |
|
| protected float | $totalQueryDuration | The duration of all executed queries in milliseconds. |
|
| protected array<array{threshold: float|int, handler: callable, has_run: bool}> | $queryDurationHandlers | All of the registered query duration handlers. |
|
| protected bool | $pretending | Indicates if the connection is in a "dry run". |
|
| protected Closure[] | $beforeStartingTransaction | All of the callbacks that should be invoked before a transaction is started. |
|
| protected Closure[] | $beforeExecutingCallbacks | All of the callbacks that should be invoked before a query is executed. |
|
| protected int | $errorCount | The number of SQL execution errors on this connection. |
|
| static protected Closure> | $resolvers | The connection resolvers. |
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.
Determine whether this connection has a transaction that delays after-commit callbacks.
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 database connection instance.
Set the query grammar to the default implementation.
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.
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 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 connection.
Get the number of open connections for the database.
Prepare the query bindings for execution.
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.
Determine if the given exception was thrown by the database driver.
Extract the index and columns 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.
Get the duration of all run queries in milliseconds.
Reset the duration of all run queries.
Handle a query exception.
Handle a query exception that occurred during query execution.
Reconnect to the database.
Reconnect to the database if the driver resources are missing.
Reconnect for the given query, reporting driver failures as query failures.
Disconnect from the underlying driver resources.
Reset the logical transaction state.
Determine whether the connection has driver resources.
Disconnect the driver resources.
Forget the driver resources without performing physical cleanup.
Notify the resource owner that the current driver resources were forgotten.
Determine whether the connection is responsive.
Determine whether the connection may be reused.
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.
Retain the physical database session for the duration of the callback.
Determine whether an operation requires the current physical session.
Begin a foreign key constraint suppression scope.
End a foreign key constraint suppression scope.
Reset all wrapper state for pool release.
Get the number of SQL execution errors on this connection.
Fire an event for this connection.
Fire the given event.
Get a new raw query expression.
Escape a value for safe SQL embedding.
Escape a string value for safe SQL embedding.
Escape a boolean 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.
Reset the record modification state.
Indicate that the connection should use the write connection for reads.
Resolve and record the connection role for an operation.
Mark the current physical session state as unknown.
Execute an internal physical-session statement.
Set the reconnect instance on the connection.
Set the resource owner's callback for forgotten driver resources.
Stop notifying the pool and restart error tracking once a leased physical connection is returned.
Get the database connection name.
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 the database driver name.
Get a human-readable name for the given connection driver.
Get the default database driver name.
Get the query grammar used by the connection.
Get the schema grammar used by the connection.
Get the query post processor used by the connection.
Get the event dispatcher used by the connection.
Unset the event dispatcher for this connection.
Run the statement to start a new transaction.
Create a save point within the database.
Commit the active physical transaction.
Perform a rollback within the database.
Determine whether the connection has an active physical transaction.
Determine whether any owned driver resource has an active transaction.
Set the transaction manager instance on the connection.
Get the transaction manager instance.
Unset the transaction manager for this connection.
Determine if the connection is in a "dry run".
Get the connection query log.
Get the connection query log with embedded bindings.
Clear the query log.
Enable the query log on the connection.
Disable the query log on the connection.
Determine whether we're logging queries.
Get the name of the connected database.
Set the name of the connected database.
Set the read / write type of the connection.
Retrieve the latest read / write type used.
Get the table prefix for the connection.
Set the table prefix in use by the connection.
Get the server version for the connection.
Get the ID of the last committed transaction.
Calculate the commit ID for a set of commit IDs that includes all of them.
Determine if the given commit ID has been applied.
Determine whether the server supports skipping locked rows.
Get the connection resolver for the given driver.
Flush all static state.
Prepare the instance for cloning.
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 129
protected void
handleTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)
Handle an exception encountered when running a transacted statement.
in
ManagesTransactions at line 177
void
beginTransaction()
Start a new database transaction.
in
ManagesTransactions at line 215
protected void
createTransaction()
Create a transaction within the database.
in
ManagesTransactions at line 235
protected void
handleBeginTransactionException(Throwable $e)
Handle an exception from a transaction beginning.
in
ManagesTransactions at line 251
void
commit()
Commit the active database transaction.
in
ManagesTransactions at line 299
protected void
handleCommitTransactionException(Throwable $e, int $currentAttempt, int $maxAttempts)
Handle an exception encountered when committing a transaction.
in
ManagesTransactions at line 342
void
rollBack(int|null $toLevel = null)
Rollback the active database transaction.
in
ManagesTransactions at line 413
protected void
handleRollBackException(Throwable $e)
Handle an exception from a rollback.
in
ManagesTransactions at line 433
protected void
forgetLostConnection()
Forget a connection after a lost transaction operation.
in
ManagesTransactions at line 450
int
transactionLevel()
Get the number of active transactions.
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.
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.
in
ManagesTransactions at line 490
void
afterCommitOrNow(callable $callback)
Execute the callback after commit, or immediately when no transaction exists.
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.
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 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.
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.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
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.
in
Macroable at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 224
__construct(string $database = '', string $tablePrefix = '', array $config = [])
Create a new database connection instance.
at line 251
void
useDefaultQueryGrammar()
Set the query grammar to the default implementation.
at line 259
protected Grammar
getDefaultQueryGrammar()
Get the default query grammar instance.
at line 267
void
useDefaultSchemaGrammar()
Set the schema grammar to the default implementation.
at line 275
protected Grammar|null
getDefaultSchemaGrammar()
Get the default schema grammar instance.
at line 283
void
useDefaultPostProcessor()
Set the query post processor to the default implementation.
at line 291
protected Processor
getDefaultPostProcessor()
Get the default post processor instance.
at line 299
Builder
getSchemaBuilder()
Get a schema builder instance for the connection.
at line 313
SchemaState
getSchemaState(Filesystem|null $files = null, callable|null $processFactory = null)
Get the schema state for the 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.
at line 335
Builder
query()
Get a new query builder instance.
at line 347
mixed
selectOne(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement and return a single result.
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.
at line 379
array
selectFromWriteConnection(string $query, array $bindings = [])
Run a select statement against the database.
at line 387
abstract array
select(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])
Run a select statement against the database.
at line 392
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.
at line 405
abstract Generator
cursor(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])
Run a select statement against the database and return a generator.
at line 410
bool
insert(string $query, array $bindings = [])
Run an insert statement against the database.
at line 418
int|string
getLastInsertId(string|null $sequence = null)
Get the last insert ID.
at line 429
int
update(string $query, array $bindings = [])
Run an update statement against the database.
at line 437
int
delete(string $query, array $bindings = [])
Run a delete statement against the database.
at line 445
abstract bool
statement(string $query, array $bindings = [])
Execute an SQL statement and return the boolean result.
at line 450
abstract int
affectingStatement(string $query, array $bindings = [])
Run an SQL statement and get the number of rows affected.
at line 455
abstract bool
unprepared(string $query)
Run a raw, unprepared query against the connection.
at line 460
int|null
threadCount()
Get the number of open connections for the database.
at line 473
array
pretend(Closure $callback)
Execute the given callback in "dry run" mode.
at line 499
mixed
withoutPretending(Closure $callback)
Execute the given callback without "pretending".
at line 520
protected array
withFreshQueryLog(Closure $callback)
Execute the given callback in "dry run" mode.
at line 544
array
prepareBindings(array $bindings)
Prepare the query bindings for execution.
at line 568
protected mixed
run(string $query, array $bindings, Closure $callback)
Run a SQL statement and log its execution context.
at line 646
protected Generator
runStreaming(string $query, array $bindings, Closure $callback)
Run a streaming SQL statement and log only its complete execution.
at line 733
protected mixed
runQueryCallback(string $query, array $bindings, Closure $callback)
Run a SQL statement.
at line 759
protected QueryException
newQueryException(string $query, array $bindings, Exception $previous)
Create an exception containing the query and connection context.
at line 791
protected bool
isUniqueConstraintError(Exception $exception)
Determine if the given database exception was caused by a unique constraint violation.
at line 799
protected bool
isDataTypeError(Exception $exception)
Determine if the given database exception was caused by an invalid or out of range value.
at line 807
protected bool
isDriverError(Exception $exception)
Determine if the given exception was thrown by the database driver.
at line 817
protected array
parseUniqueConstraintViolation(Exception $exception)
Extract the index and columns that caused a unique constraint violation.
at line 825
void
logQuery(string $query, array $bindings, float|null $time = null)
Log a query in the connection's query log.
at line 866
protected float
getElapsedTime(float $start)
Get the elapsed time in milliseconds since a given starting point.
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.
at line 894
void
allowQueryDurationHandlersToRunAgain()
Allow all the query duration handlers to run again, even if they have already run.
at line 904
float
totalQueryDuration()
Get the duration of all run queries in milliseconds.
at line 912
void
resetTotalQueryDuration()
Reset the duration of all run queries.
at line 923
protected mixed
handleQueryException(QueryException $e, string $query, array $bindings, Closure $callback)
Handle a query exception.
at line 943
protected mixed
tryAgainIfCausedByLostConnection(QueryException $e, string $query, array $bindings, Closure $callback)
Handle a query exception that occurred during query execution.
at line 966
mixed
reconnect()
Reconnect to the database.
at line 978
void
reconnectIfMissingConnection()
Reconnect to the database if the driver resources are missing.
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.
at line 1016
final void
refreshFrom(Connection $fresh)
| internal |
Refresh the driver resources from a fresh connection.
at line 1034
void
disconnect()
Disconnect from the underlying driver resources.
at line 1063
protected void
resetTransactionState()
Reset the logical transaction state.
at line 1073
abstract protected bool
hasDriverResources()
Determine whether the connection has driver resources.
at line 1082
abstract protected void
disconnectDriverResources()
Disconnect the driver resources.
Implementations must forget the current resources through forgetDriverResources() in a finally block so cleanup failure cannot leave stale resources attached.
at line 1087
abstract protected void
forgetDriverResources()
Forget the driver resources without performing physical cleanup.
at line 1092
protected void
notifyResourceReleaser()
Notify the resource owner that the current driver resources were forgotten.
at line 1108
abstract protected void
replaceDriverResources(Connection $fresh)
Refresh the driver resources from a fresh connection.
Validate and capture a complete replacement set of driver resources and resource-associated metadata, including the configured database and table prefix baselines. Adopt it in a finally block around teardown. The original teardown throwable must propagate unchanged. Preserve the existing read / write role, which belongs to the current borrow.
at line 1115
abstract bool
ping()
| internal |
Determine whether the connection is responsive.
at line 1122
bool
isReusable()
| internal |
Determine whether the connection may be reused.
at line 1132
Connection
beforeStartingTransaction(Closure $callback)
Register a hook to be run just before a database transaction is started.
at line 1144
Connection
beforeExecuting(Closure $callback)
Register a hook to be run just before a database query is executed.
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.
at line 1169
mixed
withPinnedSession(Closure $callback)
Retain the physical database session for the duration of the callback.
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.
at line 1199
bool
beginForeignKeyConstraintSuppression()
| internal |
Begin a foreign key constraint suppression scope.
at line 1209
void
endForeignKeyConstraintSuppression()
| internal |
End a foreign key constraint suppression scope.
at line 1225
void
resetForPool()
Reset all wrapper state for pool release.
Mutable connection metadata is restored to its configured values. Trustworthy physical session state is preserved and synchronized against the next coroutine's desired state when the connection is handed out again.
at line 1266
int
getErrorCount()
Get the number of SQL execution errors on this connection.
Used by connection pooling to detect stale connections.
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.
at line 1287
protected void
fireConnectionEvent(string $event)
Fire an event for this connection.
at line 1316
protected void
event(object $event)
Fire the given event.
at line 1324
Expression
raw(mixed $value)
Get a new raw query expression.
at line 1334
string
escape(mixed $value, bool $binary = false)
Escape a value for safe SQL embedding.
at line 1369
abstract protected string
escapeString(string $value)
Escape a string value for safe SQL embedding.
at line 1374
protected string
escapeBool(bool $value)
Escape a boolean value for safe SQL embedding.
at line 1384
protected string
escapeBinary(string $value)
Escape a binary value for safe SQL embedding.
at line 1392
bool
hasModifiedRecords()
Determine if the database connection has modified any database records.
at line 1400
void
recordsHaveBeenModified(bool $value = true)
Indicate if any records have been modified.
at line 1412
Connection
setRecordModificationState(bool $value)
Set the record modification state.
at line 1422
void
forgetRecordModificationState()
Reset the record modification state.
at line 1432
Connection
useWriteConnectionWhenReading(bool $value = true)
Indicate that the connection should use the write connection for reads.
at line 1447
mixed
usingWritePdo(Closure $callback)
Execute the given callback using the write connection for reads.
at line 1465
protected string
resolveReadWriteType(bool $read = true)
Resolve and record the connection role for an operation.
at line 1482
void
markCurrentSessionStateUnknown()
| internal |
Mark the current physical session state as unknown.
at line 1491
void
executeSessionStatement(string $sql)
| internal |
Execute an internal physical-session statement.
at line 1504
Connection
setReconnector(callable $reconnector)
Set the reconnect instance on the connection.
at line 1518
void
setResourceReleaser(Closure $callback)
| internal |
Set the resource owner's callback for forgotten driver resources.
at line 1528
void
detachLeasedResources()
| internal |
Stop notifying the pool and restart error tracking once a leased physical connection is returned.
at line 1537
string|null
getName()
Get the database connection name.
at line 1545
string|null
getNameWithReadWriteType()
Get the database connection with its read / write type.
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.
at line 1570
mixed
getConfig(string|null $option = null)
Get an option from the configuration options.
at line 1578
protected array
getConnectionDetails()
Get the basic connection information as an array for debugging.
at line 1597
string
getDriverName()
Get the database driver name.
at line 1605
string
getDriverTitle()
Get a human-readable name for the given connection driver.
at line 1613
abstract protected string
getDefaultDriverName()
Get the default database driver name.
at line 1618
Grammar
getQueryGrammar()
Get the query grammar used by the connection.
at line 1628
Connection
setQueryGrammar(Grammar $grammar)
Set the query grammar used by the connection.
at line 1638
Grammar|null
getSchemaGrammar()
Get the schema grammar used by the connection.
at line 1648
Connection
setSchemaGrammar(Grammar $grammar)
Set the schema grammar used by the connection.
at line 1658
Processor
getPostProcessor()
Get the query post processor used by the connection.
at line 1668
Connection
setPostProcessor(Processor $processor)
Set the query post processor used by the connection.
at line 1678
Dispatcher|null
getEventDispatcher()
Get the event dispatcher used by the 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.
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.
at line 1716
protected void
executeBeginTransactionStatement()
Run the statement to start a new transaction.
at line 1726
protected void
createSavepoint()
Create a save point within the database.
at line 1734
protected void
performCommit()
Commit the active physical transaction.
at line 1744
protected void
performRollBack(int $toLevel)
Perform a rollback within the database.
at line 1763
abstract bool
inTransaction()
Determine whether the connection has an active physical transaction.
at line 1770
bool
hasPhysicalTransaction()
| internal |
Determine whether any owned driver resource has an active transaction.
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.
at line 1795
DatabaseTransactionsManager|null
getTransactionManager()
Get the transaction manager instance.
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.
at line 1816
bool
pretending()
Determine if the connection is in a "dry run".
at line 1826
array
getQueryLog()
Get the connection query log.
at line 1834
array
getRawQueryLog()
Get the connection query log with embedded bindings.
at line 1848
void
flushQueryLog()
Clear the query log.
at line 1856
void
enableQueryLog()
Enable the query log on the connection.
at line 1864
void
disableQueryLog()
Disable the query log on the connection.
at line 1872
bool
logging()
Determine whether we're logging queries.
at line 1880
string
getDatabaseName()
Get the name of the connected database.
at line 1890
Connection
setDatabaseName(string $database)
Set the name of the connected database.
at line 1902
Connection
setReadWriteType(string|null $readWriteType)
Set the read / write type of the connection.
at line 1914
protected string|null
latestReadWriteTypeUsed()
Retrieve the latest read / write type used.
at line 1922
string
getTablePrefix()
Get the table prefix for the connection.
at line 1932
Connection
setTablePrefix(string $prefix)
Set the table prefix in use by the connection.
at line 1947
mixed
withoutTablePrefix(Closure $callback)
Execute the given callback without table prefix.
at line 1963
abstract string
getServerVersion()
Get the server version for the connection.
at line 1970
string
getLastCommitId()
Get the ID of the last committed transaction.
at line 1982
string
mergeCommitIds(array $values)
Calculate the commit ID for a set of commit IDs that includes all of them.
at line 1992
bool
hasCommitId(string $value, int $wait = 0)
Determine if the given commit ID has been applied.
at line 2000
bool
supportsSkipLocked()
Determine whether the server supports skipping locked rows.
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.
at line 2021
static Closure|null
getResolver(string $driver)
Get the connection resolver for the given driver.
at line 2029
static void
flushState()
Flush all static state.
at line 2038
void
__clone()
Prepare the instance for cloning.