class SQLiteConnection extends Connection (View source)

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected PDO|Closure $pdo

The active PDO connection.

from  Connection
protected PDO|Closure $readPdo

The active PDO connection used for reads.

from  Connection
protected string $database

The name of the connected database.

from  Connection
protected string|null $readWriteType

The type of the connection.

from  Connection
protected string $tablePrefix

The table prefix for the connection.

from  Connection
protected array $config

The database connection configuration options.

from  Connection
protected callable $reconnector

The reconnector instance for the connection.

from  Connection
protected Grammar $queryGrammar

The query grammar implementation.

from  Connection
protected Grammar $schemaGrammar

The schema grammar implementation.

from  Connection
protected Processor $postProcessor

The query post processor implementation.

from  Connection
protected Dispatcher $events

The event dispatcher instance.

from  Connection
protected int $fetchMode

The default fetch mode of the connection.

from  Connection
protected int $transactions

The number of active transactions.

from  Connection
protected DatabaseTransactionsManager $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" PDO connection.

from  Connection
protected array $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 $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 Connection $doctrineConnection

The instance of Doctrine connection.

from  Connection
protected array<string,string> $doctrineTypeMappings

Type mappings that should be registered with new Doctrine connections.

from  Connection
static protected Closure[] $resolvers

The connection resolvers.

from  Connection

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)

Execute a Closure within a transaction.

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
createSavepoint()

Create a save point 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
performRollBack(int $toLevel)

Perform a rollback within the database.

void
handleRollBackException(Throwable $e)

Handle an exception from a rollback.

int
transactionLevel()

Get the number of active transactions.

void
afterCommit(callable $callback)

Execute the callback after a transaction commits.

int
secondsUntil(DateTimeInterface|DateInterval|int $delay)

Get the number of seconds until the given DateTime.

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

Get the "available at" UNIX timestamp.

parseDateInterval(DateTimeInterface|DateInterval|int $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.

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

Register a custom macro.

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

Mix another object into the class.

static bool
hasMacro(string $name)

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

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

Create a new 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.

table(Closure|Builder|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)

Run a select statement against the database.

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

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

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

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

prepared(PDOStatement $statement)

Configure the PDO prepared statement.

PDO
getPdoForSelect(bool $useReadPdo = true)

Get the PDO connection to use for a select query.

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

Run an insert statement against the database.

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.

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.

void
bindValues(PDOStatement $statement, array $bindings)

Bind values to their parameters in the given statement.

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.

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

Run a SQL statement.

bool
isUniqueConstraintError(Exception $exception)

Determine if the given database exception was caused by 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(int $start)

Get the elapsed time 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|false
reconnect()

Reconnect to the database.

void
reconnectIfMissingConnection()

Reconnect to the database if a PDO connection is missing.

void
disconnect()

Disconnect from the underlying PDO connection.

$this
beforeStartingTransaction(Closure $callback)

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

$this
beforeExecuting(Closure $callback)

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

void
listen(Closure $callback)

Register a database query listener with the connection.

array|null
fireConnectionEvent(string $event)

Fire an event for this connection.

void
event(mixed $event)

Fire the given event if possible.

raw(mixed $value)

Get a new raw query expression.

string
escape(string|float|int|bool|null $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.

$this
setRecordModificationState(bool $value)

Set the record modification state.

void
forgetRecordModificationState()

Reset the record modification state.

$this
useWriteConnectionWhenReading(bool $value = true)

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

bool
isDoctrineAvailable()

Is Doctrine available?

bool
usingNativeSchemaOperations()

Indicates whether native alter operations will be used when dropping, renaming, or modifying columns, even if Doctrine DBAL is installed.

Column
getDoctrineColumn(string $table, string $column)

Get a Doctrine Schema Column instance.

AbstractSchemaManager
getDoctrineSchemaManager()

Get the Doctrine DBAL schema manager for the connection.

Connection
getDoctrineConnection()

Get the Doctrine DBAL database connection instance.

void
registerDoctrineType(Type|string $class, string $name, string $type)

Register a custom Doctrine mapping type.

PDO
getPdo()

Get the current PDO connection.

PDO|Closure|null
getRawPdo()

Get the current PDO connection parameter without executing any reconnect logic.

PDO
getReadPdo()

Get the current PDO connection used for reading.

PDO|Closure|null
getRawReadPdo()

Get the current read PDO connection parameter without executing any reconnect logic.

$this
setPdo(PDO|Closure|null $pdo)

Set the PDO connection.

$this
setReadPdo(PDO|Closure|null $pdo)

Set the PDO connection used for reading.

$this
setReconnector(callable $reconnector)

Set the reconnect instance on the connection.

string|null
getName()

Get the database connection name.

string|null
getNameWithReadWriteType()

Get the database connection full name.

mixed
getConfig(string|null $option = null)

Get an option from the configuration options.

string
getDriverName()

Get the PDO driver name.

getQueryGrammar()

Get the query grammar used by the connection.

$this
setQueryGrammar(Grammar $grammar)

Set the query grammar used by the connection.

getSchemaGrammar()

Get the schema grammar used by the connection.

$this
setSchemaGrammar(Grammar $grammar)

Set the schema grammar used by the connection.

getPostProcessor()

Get the query post processor used by the connection.

$this
setPostProcessor(Processor $processor)

Set the query post processor used by the connection.

getEventDispatcher()

Get the event dispatcher used by the connection.

$this
setEventDispatcher(Dispatcher $events)

Set the event dispatcher instance on the connection.

void
unsetEventDispatcher()

Unset the event dispatcher for this connection.

$this
setTransactionManager(DatabaseTransactionsManager $manager)

Set the transaction manager instance on the connection.

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.

$this
setDatabaseName(string $database)

Set the name of the connected database.

$this
setReadWriteType(string|null $readWriteType)

Set the read / write type of the connection.

string
getTablePrefix()

Get the table prefix for the connection.

$this
setTablePrefix(string $prefix)

Set the table prefix in use by the connection.

withTablePrefix(Grammar $grammar)

Set the table prefix and return the grammar.

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

Register a connection resolver.

static mixed
getResolver(string $driver)

Get the connection resolver for the given driver.

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

Get the schema state for the connection.

getDoctrineDriver()

Get the Doctrine DBAL driver.

bool|null
getForeignKeyConstraintsConfigurationValue()

Get the database connection foreign key constraints configuration option.

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)

Execute a Closure within a transaction.

Parameters

Closure $callback
int $attempts

Return Value

mixed

Exceptions

Throwable

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

void beginTransaction()

Start a new database transaction.

Return Value

void

Exceptions

Throwable

protected void createTransaction()

Create a transaction within the database.

Return Value

void

Exceptions

Throwable

protected void createSavepoint()

Create a save point within the database.

Return Value

void

Exceptions

Throwable

protected void handleBeginTransactionException(Throwable $e)

Handle an exception from a transaction beginning.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

void commit()

Commit the active database transaction.

Return Value

void

Exceptions

Throwable

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

void rollBack(int|null $toLevel = null)

Rollback the active database transaction.

Parameters

int|null $toLevel

Return Value

void

Exceptions

Throwable

protected void performRollBack(int $toLevel)

Perform a rollback within the database.

Parameters

int $toLevel

Return Value

void

Exceptions

Throwable

protected void handleRollBackException(Throwable $e)

Handle an exception from a rollback.

Parameters

Throwable $e

Return Value

void

Exceptions

Throwable

int transactionLevel()

Get the number of active transactions.

Return Value

int

void afterCommit(callable $callback)

Execute the callback after a transaction commits.

Parameters

callable $callback

Return Value

void

Exceptions

RuntimeException

protected int secondsUntil(DateTimeInterface|DateInterval|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

int

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

Get the "available at" UNIX timestamp.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

int

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

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

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

DateTimeInterface|int

protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

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

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

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

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static void flushMacros()

Flush the existing macros.

Return Value

void

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

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

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

Create a new database connection instance.

Parameters

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

Return Value

void

void useDefaultQueryGrammar()

Set the query grammar to the default implementation.

Return Value

void

protected Grammar getDefaultQueryGrammar()

Get the default query grammar instance.

Return Value

Grammar

void useDefaultSchemaGrammar()

Set the schema grammar to the default implementation.

Return Value

void

protected Grammar|null getDefaultSchemaGrammar()

Get the default schema grammar instance.

Return Value

Grammar|null

void useDefaultPostProcessor()

Set the query post processor to the default implementation.

Return Value

void

protected Processor getDefaultPostProcessor()

Get the default post processor instance.

Return Value

Processor

Builder getSchemaBuilder()

Get a schema builder instance for the connection.

Return Value

Builder

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

Begin a fluent query against a database table.

Parameters

Closure|Builder|string $table
string|null $as

Return Value

Builder

Builder query()

Get a new query builder instance.

Return Value

Builder

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

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

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

Run a select statement against the database.

Parameters

string $query
array $bindings

Return Value

array

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

Run a select statement against the database.

Parameters

string $query
array $bindings
bool $useReadPdo

Return Value

array

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

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

Parameters

string $query
array $bindings
bool $useReadPdo

Return Value

array

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

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

Parameters

string $query
array $bindings
bool $useReadPdo

Return Value

Generator

protected PDOStatement prepared(PDOStatement $statement)

Configure the PDO prepared statement.

Parameters

PDOStatement $statement

Return Value

PDOStatement

protected PDO getPdoForSelect(bool $useReadPdo = true)

Get the PDO connection to use for a select query.

Parameters

bool $useReadPdo

Return Value

PDO

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

Run an insert statement against the database.

Parameters

string $query
array $bindings

Return Value

bool

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

Run an update statement against the database.

Parameters

string $query
array $bindings

Return Value

int

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

Run a delete statement against the database.

Parameters

string $query
array $bindings

Return Value

int

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

Execute an SQL statement and return the boolean result.

Parameters

string $query
array $bindings

Return Value

bool

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

bool unprepared(string $query)

Run a raw, unprepared query against the PDO connection.

Parameters

string $query

Return Value

bool

array pretend(Closure $callback)

Execute the given callback in "dry run" mode.

Parameters

Closure $callback

Return Value

array

mixed withoutPretending(Closure $callback)

Execute the given callback without "pretending".

Parameters

Closure $callback

Return Value

mixed

protected array withFreshQueryLog(Closure $callback)

Execute the given callback in "dry run" mode.

Parameters

Closure $callback

Return Value

array

void bindValues(PDOStatement $statement, array $bindings)

Bind values to their parameters in the given statement.

Parameters

PDOStatement $statement
array $bindings

Return Value

void

array prepareBindings(array $bindings)

Prepare the query bindings for execution.

Parameters

array $bindings

Return Value

array

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

QueryException

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

Run a SQL statement.

Parameters

string $query
array $bindings
Closure $callback

Return Value

mixed

Exceptions

QueryException

protected bool isUniqueConstraintError(Exception $exception)

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

Parameters

Exception $exception

Return Value

bool

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

protected float getElapsedTime(int $start)

Get the elapsed time since a given starting point.

Parameters

int $start

Return Value

float

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

void allowQueryDurationHandlersToRunAgain()

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

Return Value

void

float totalQueryDuration()

Get the duration of all run queries in milliseconds.

Return Value

float

void resetTotalQueryDuration()

Reset the duration of all run queries.

Return Value

void

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

QueryException

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

QueryException

mixed|false reconnect()

Reconnect to the database.

Return Value

mixed|false

Exceptions

LostConnectionException

void reconnectIfMissingConnection()

Reconnect to the database if a PDO connection is missing.

Return Value

void

void disconnect()

Disconnect from the underlying PDO connection.

Return Value

void

$this beforeStartingTransaction(Closure $callback)

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

Parameters

Closure $callback

Return Value

$this

$this beforeExecuting(Closure $callback)

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

Parameters

Closure $callback

Return Value

$this

void listen(Closure $callback)

Register a database query listener with the connection.

Parameters

Closure $callback

Return Value

void

protected array|null fireConnectionEvent(string $event)

Fire an event for this connection.

Parameters

string $event

Return Value

array|null

protected void event(mixed $event)

Fire the given event if possible.

Parameters

mixed $event

Return Value

void

Expression raw(mixed $value)

Get a new raw query expression.

Parameters

mixed $value

Return Value

Expression

string escape(string|float|int|bool|null $value, bool $binary = false)

Escape a value for safe SQL embedding.

Parameters

string|float|int|bool|null $value
bool $binary

Return Value

string

protected string escapeString(string $value)

Escape a string value for safe SQL embedding.

Parameters

string $value

Return Value

string

protected string escapeBool(bool $value)

Escape a boolean value for safe SQL embedding.

Parameters

bool $value

Return Value

string

protected string escapeBinary(string $value)

Escape a binary value for safe SQL embedding.

Parameters

string $value

Return Value

string

bool hasModifiedRecords()

Determine if the database connection has modified any database records.

Return Value

bool

void recordsHaveBeenModified(bool $value = true)

Indicate if any records have been modified.

Parameters

bool $value

Return Value

void

$this setRecordModificationState(bool $value)

Set the record modification state.

Parameters

bool $value

Return Value

$this

void forgetRecordModificationState()

Reset the record modification state.

Return Value

void

$this useWriteConnectionWhenReading(bool $value = true)

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

Parameters

bool $value

Return Value

$this

bool isDoctrineAvailable()

Is Doctrine available?

Return Value

bool

bool usingNativeSchemaOperations()

Indicates whether native alter operations will be used when dropping, renaming, or modifying columns, even if Doctrine DBAL is installed.

Return Value

bool

Column getDoctrineColumn(string $table, string $column)

Get a Doctrine Schema Column instance.

Parameters

string $table
string $column

Return Value

Column

AbstractSchemaManager getDoctrineSchemaManager()

Get the Doctrine DBAL schema manager for the connection.

Return Value

AbstractSchemaManager

Connection getDoctrineConnection()

Get the Doctrine DBAL database connection instance.

Return Value

Connection

void registerDoctrineType(Type|string $class, string $name, string $type)

Register a custom Doctrine mapping type.

Parameters

Type|string $class
string $name
string $type

Return Value

void

Exceptions

Exception
RuntimeException

PDO getPdo()

Get the current PDO connection.

Return Value

PDO

PDO|Closure|null getRawPdo()

Get the current PDO connection parameter without executing any reconnect logic.

Return Value

PDO|Closure|null

PDO getReadPdo()

Get the current PDO connection used for reading.

Return Value

PDO

PDO|Closure|null getRawReadPdo()

Get the current read PDO connection parameter without executing any reconnect logic.

Return Value

PDO|Closure|null

$this setPdo(PDO|Closure|null $pdo)

Set the PDO connection.

Parameters

PDO|Closure|null $pdo

Return Value

$this

$this setReadPdo(PDO|Closure|null $pdo)

Set the PDO connection used for reading.

Parameters

PDO|Closure|null $pdo

Return Value

$this

$this setReconnector(callable $reconnector)

Set the reconnect instance on the connection.

Parameters

callable $reconnector

Return Value

$this

string|null getName()

Get the database connection name.

Return Value

string|null

string|null getNameWithReadWriteType()

Get the database connection full name.

Return Value

string|null

mixed getConfig(string|null $option = null)

Get an option from the configuration options.

Parameters

string|null $option

Return Value

mixed

string getDriverName()

Get the PDO driver name.

Return Value

string

Grammar getQueryGrammar()

Get the query grammar used by the connection.

Return Value

Grammar

$this setQueryGrammar(Grammar $grammar)

Set the query grammar used by the connection.

Parameters

Grammar $grammar

Return Value

$this

Grammar getSchemaGrammar()

Get the schema grammar used by the connection.

Return Value

Grammar

$this setSchemaGrammar(Grammar $grammar)

Set the schema grammar used by the connection.

Parameters

Grammar $grammar

Return Value

$this

Processor getPostProcessor()

Get the query post processor used by the connection.

Return Value

Processor

$this setPostProcessor(Processor $processor)

Set the query post processor used by the connection.

Parameters

Processor $processor

Return Value

$this

Dispatcher getEventDispatcher()

Get the event dispatcher used by the connection.

Return Value

Dispatcher

$this setEventDispatcher(Dispatcher $events)

Set the event dispatcher instance on the connection.

Parameters

Dispatcher $events

Return Value

$this

void unsetEventDispatcher()

Unset the event dispatcher for this connection.

Return Value

void

$this setTransactionManager(DatabaseTransactionsManager $manager)

Set the transaction manager instance on the connection.

Parameters

DatabaseTransactionsManager $manager

Return Value

$this

void unsetTransactionManager()

Unset the transaction manager for this connection.

Return Value

void

bool pretending()

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

Return Value

bool

array getQueryLog()

Get the connection query log.

Return Value

array

array getRawQueryLog()

Get the connection query log with embedded bindings.

Return Value

array

void flushQueryLog()

Clear the query log.

Return Value

void

void enableQueryLog()

Enable the query log on the connection.

Return Value

void

void disableQueryLog()

Disable the query log on the connection.

Return Value

void

bool logging()

Determine whether we're logging queries.

Return Value

bool

string getDatabaseName()

Get the name of the connected database.

Return Value

string

$this setDatabaseName(string $database)

Set the name of the connected database.

Parameters

string $database

Return Value

$this

$this setReadWriteType(string|null $readWriteType)

Set the read / write type of the connection.

Parameters

string|null $readWriteType

Return Value

$this

string getTablePrefix()

Get the table prefix for the connection.

Return Value

string

$this setTablePrefix(string $prefix)

Set the table prefix in use by the connection.

Parameters

string $prefix

Return Value

$this

Grammar withTablePrefix(Grammar $grammar)

Set the table prefix and return the grammar.

Parameters

Grammar $grammar

Return Value

Grammar

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

Register a connection resolver.

Parameters

string $driver
Closure $callback

Return Value

void

static mixed getResolver(string $driver)

Get the connection resolver for the given driver.

Parameters

string $driver

Return Value

mixed

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

Get the schema state for the connection.

Parameters

Filesystem|null $files
callable|null $processFactory

Exceptions

RuntimeException

protected SQLiteDriver getDoctrineDriver()

Get the Doctrine DBAL driver.

Return Value

SQLiteDriver

protected bool|null getForeignKeyConstraintsConfigurationValue()

Get the database connection foreign key constraints configuration option.

Return Value

bool|null