SQLiteConnection
class SQLiteConnection extends Connection
Traits
Properties
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 | $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 array | $queryLog | All of the queries run against the connection. |
from Connection |
protected bool | $loggingQueries | Indicates whether queries are being logged. |
from Connection |
protected bool | $pretending | Indicates if the connection is in a "dry run". |
from Connection |
protected Connection | $doctrineConnection | The instance of Doctrine connection. |
from Connection |
static protected array | $resolvers | The connection resolvers. |
from Connection |
Methods
Determine if the given exception was caused by a lost connection.
Handle an exception encountered when running a transacted statement.
Rollback the active database transaction.
Create a new 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.
Run a select statement and return a single result.
Run a select statement against the database.
Run a select statement against the database.
Run a select statement against the database and returns a generator.
Get the PDO connection to use for a select query.
Run an insert statement against the database.
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.
Bind values to their parameters in the given statement.
Run a SQL statement and log its execution context.
Log a query in the connection's query log.
Handle a query exception.
Handle a query exception that occurred during query execution.
Reconnect to the database if a PDO connection is missing.
Get a Doctrine Schema Column instance.
Get the Doctrine DBAL schema manager for the connection.
Get the Doctrine DBAL database connection instance.
Set the reconnect instance on the connection.
Get an option from the configuration options.
Get the connection resolver for the given driver.
Get the Doctrine DBAL driver.
Details
in
DetectsDeadlocks at line 16
protected bool
causedByDeadlock(Exception $e)
Determine if the given exception was caused by a deadlock.
in
DetectsLostConnections at line 16
protected bool
causedByLostConnection(Exception $e)
Determine if the given exception was caused by a lost connection.
in
ManagesTransactions at line 20
mixed
transaction(Closure $callback, int $attempts = 1)
Execute a Closure within a transaction.
in
ManagesTransactions at line 59
protected void
handleTransactionException(Exception $e, int $currentAttempt, int $maxAttempts)
Handle an exception encountered when running a transacted statement.
in
ManagesTransactions at line 90
void
beginTransaction()
Start a new database transaction.
in
ManagesTransactions at line 104
protected void
createTransaction()
Create a transaction within the database.
in
ManagesTransactions at line 122
protected void
createSavepoint()
Create a save point within the database.
in
ManagesTransactions at line 137
protected void
handleBeginTransactionException(Exception $e)
Handle an exception from a transaction beginning.
in
ManagesTransactions at line 153
void
commit()
Commit the active database transaction.
in
ManagesTransactions at line 170
void
rollBack(int|null $toLevel = null)
Rollback the active database transaction.
in
ManagesTransactions at line 199
protected void
performRollBack(int $toLevel)
Perform a rollback within the database.
in
ManagesTransactions at line 215
int
transactionLevel()
Get the number of active transactions.
in
Connection at line 155
void
__construct(PDO|Closure $pdo, string $database = '', string $tablePrefix = '', array $config = [])
Create a new database connection instance.
in
Connection at line 181
void
useDefaultQueryGrammar()
Set the query grammar to the default implementation.
at line 17
protected Grammar
getDefaultQueryGrammar()
Get the default query grammar instance.
in
Connection at line 201
void
useDefaultSchemaGrammar()
Set the schema grammar to the default implementation.
at line 27
protected Grammar
getDefaultSchemaGrammar()
Get the default schema grammar instance.
in
Connection at line 221
void
useDefaultPostProcessor()
Set the query post processor to the default implementation.
at line 37
protected Processor
getDefaultPostProcessor()
Get the default post processor instance.
in
Connection at line 241
Builder
getSchemaBuilder()
Get a schema builder instance for the connection.
in
Connection at line 256
Builder
table(string $table)
Begin a fluent query against a database table.
in
Connection at line 266
Builder
query()
Get a new query builder instance.
in
Connection at line 281
mixed
selectOne(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement and return a single result.
in
Connection at line 295
array
selectFromWriteConnection(string $query, array $bindings = [])
Run a select statement against the database.
in
Connection at line 308
array
select(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement against the database.
in
Connection at line 337
Generator
cursor(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement against the database and returns a generator.
in
Connection at line 373
protected PDOStatement
prepared(PDOStatement $statement)
Configure the PDO prepared statement.
in
Connection at line 390
protected PDO
getPdoForSelect(bool $useReadPdo = true)
Get the PDO connection to use for a select query.
in
Connection at line 402
bool
insert(string $query, array $bindings = [])
Run an insert statement against the database.
in
Connection at line 414
int
update(string $query, array $bindings = [])
Run an update statement against the database.
in
Connection at line 426
int
delete(string $query, array $bindings = [])
Run a delete statement against the database.
in
Connection at line 438
bool
statement(string $query, array $bindings = [])
Execute an SQL statement and return the boolean result.
in
Connection at line 460
int
affectingStatement(string $query, array $bindings = [])
Run an SQL statement and get the number of rows affected.
in
Connection at line 486
bool
unprepared(string $query)
Run a raw, unprepared query against the PDO connection.
in
Connection at line 503
array
pretend(Closure $callback)
Execute the given callback in "dry run" mode.
in
Connection at line 525
protected array
withFreshQueryLog(Closure $callback)
Execute the given callback in "dry run" mode.
in
Connection at line 553
void
bindValues(PDOStatement $statement, array $bindings)
Bind values to their parameters in the given statement.
in
Connection at line 569
array
prepareBindings(array $bindings)
Prepare the query bindings for execution.
in
Connection at line 597
protected mixed
run(string $query, array $bindings, Closure $callback)
Run a SQL statement and log its execution context.
in
Connection at line 634
protected mixed
runQueryCallback(string $query, array $bindings, Closure $callback)
Run a SQL statement.
in
Connection at line 663
void
logQuery(string $query, array $bindings, float|null $time = null)
Log a query in the connection's query log.
in
Connection at line 678
protected float
getElapsedTime(int $start)
Get the elapsed time since a given starting point.
in
Connection at line 693
protected mixed
handleQueryException(Exception $e, string $query, array $bindings, Closure $callback)
Handle a query exception.
in
Connection at line 715
protected mixed
tryAgainIfCausedByLostConnection(QueryException $e, string $query, array $bindings, Closure $callback)
Handle a query exception that occurred during query execution.
in
Connection at line 733
void
reconnect()
Reconnect to the database.
in
Connection at line 747
protected void
reconnectIfMissingConnection()
Reconnect to the database if a PDO connection is missing.
in
Connection at line 759
void
disconnect()
Disconnect from the underlying PDO connection.
in
Connection at line 770
void
listen(Closure $callback)
Register a database query listener with the connection.
in
Connection at line 783
protected array|null
fireConnectionEvent(string $event)
Fire an event for this connection.
in
Connection at line 805
protected void
event(mixed $event)
Fire the given event if possible.
in
Connection at line 818
Expression
raw(mixed $value)
Get a new raw query expression.
in
Connection at line 828
bool
isDoctrineAvailable()
Is Doctrine available?
in
Connection at line 840
Column
getDoctrineColumn(string $table, string $column)
Get a Doctrine Schema Column instance.
in
Connection at line 852
AbstractSchemaManager
getDoctrineSchemaManager()
Get the Doctrine DBAL schema manager for the connection.
in
Connection at line 862
Connection
getDoctrineConnection()
Get the Doctrine DBAL database connection instance.
in
Connection at line 880
PDO
getPdo()
Get the current PDO connection.
in
Connection at line 894
PDO
getReadPdo()
Get the current PDO connection used for reading.
in
Connection at line 913
$this
setPdo(PDO|Closure|null $pdo)
Set the PDO connection.
in
Connection at line 928
$this
setReadPdo(PDO|Closure|null $pdo)
Set the PDO connection used for reading.
in
Connection at line 941
$this
setReconnector(callable $reconnector)
Set the reconnect instance on the connection.
in
Connection at line 953
string|null
getName()
Get the database connection name.
in
Connection at line 964
mixed
getConfig(string|null $option = null)
Get an option from the configuration options.
in
Connection at line 974
string
getDriverName()
Get the PDO driver name.
in
Connection at line 984
Grammar
getQueryGrammar()
Get the query grammar used by the connection.
in
Connection at line 995
void
setQueryGrammar(Grammar $grammar)
Set the query grammar used by the connection.
in
Connection at line 1005
Grammar
getSchemaGrammar()
Get the schema grammar used by the connection.
in
Connection at line 1016
void
setSchemaGrammar(Grammar $grammar)
Set the schema grammar used by the connection.
in
Connection at line 1026
Processor
getPostProcessor()
Get the query post processor used by the connection.
in
Connection at line 1037
void
setPostProcessor(Processor $processor)
Set the query post processor used by the connection.
in
Connection at line 1047
Dispatcher
getEventDispatcher()
Get the event dispatcher used by the connection.
in
Connection at line 1058
void
setEventDispatcher(Dispatcher $events)
Set the event dispatcher instance on the connection.
in
Connection at line 1068
bool
pretending()
Determine if the connection in a "dry run".
in
Connection at line 1078
array
getQueryLog()
Get the connection query log.
in
Connection at line 1088
void
flushQueryLog()
Clear the query log.
in
Connection at line 1098
void
enableQueryLog()
Enable the query log on the connection.
in
Connection at line 1108
void
disableQueryLog()
Disable the query log on the connection.
in
Connection at line 1118
bool
logging()
Determine whether we're logging queries.
in
Connection at line 1128
string
getDatabaseName()
Get the name of the connected database.
in
Connection at line 1139
string
setDatabaseName(string $database)
Set the name of the connected database.
in
Connection at line 1149
string
getTablePrefix()
Get the table prefix for the connection.
in
Connection at line 1160
void
setTablePrefix(string $prefix)
Set the table prefix in use by the connection.
in
Connection at line 1173
Grammar
withTablePrefix(Grammar $grammar)
Set the table prefix and return the grammar.
in
Connection at line 1187
static void
resolverFor(string $driver, Closure $callback)
Register a connection resolver.
in
Connection at line 1198
static mixed
getResolver(string $driver)
Get the connection resolver for the given driver.
at line 47
protected Driver
getDoctrineDriver()
Get the Doctrine DBAL driver.