ConnectionInterface
interface ConnectionInterface
Methods
Get a new raw query expression.
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 and returns a generator.
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.
Prepare the query bindings for execution.
Start a new database transaction.
Commit the active database transaction.
Rollback the active database transaction.
Get the number of active transactions.
Get the name of the connected database.
Get the connection name.
Get the database driver name (e.g. "mysql", "pgsql", "sqlite").
Get a human-readable name for the database driver.
Get the number of open connections to the database.
Get a schema builder instance for the connection.
Get the query grammar used by the connection.
Get the query post processor used by the connection.
Get the table prefix for the connection.
Get the database server version.
Get an option from the configuration options.
Run a select statement against the database using the write connection.
Indicate if any records have been modified.
Disconnect from the underlying PDO connection.
Details
at line 23
Builder
table(Closure|Builder|UnitEnum|string $table, string|null $as = null)
Begin a fluent query against a database table.
at line 28
Expression
raw(mixed $value)
Get a new raw query expression.
at line 33
mixed
selectOne(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement and return a single result.
at line 40
mixed
scalar(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement and return the first column of the first row.
at line 45
array
select(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])
Run a select statement against the database.
at line 50
Generator
cursor(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])
Run a select statement against the database and returns a generator.
at line 55
bool
insert(string $query, array $bindings = [])
Run an insert statement against the database.
at line 60
int
update(string $query, array $bindings = [])
Run an update statement against the database.
at line 65
int
delete(string $query, array $bindings = [])
Run a delete statement against the database.
at line 70
bool
statement(string $query, array $bindings = [])
Execute an SQL statement and return the boolean result.
at line 75
int
affectingStatement(string $query, array $bindings = [])
Run an SQL statement and get the number of rows affected.
at line 80
bool
unprepared(string $query)
Run a raw, unprepared query against the PDO connection.
at line 85
array
prepareBindings(array $bindings)
Prepare the query bindings for execution.
at line 97
mixed
transaction(Closure $callback, int $attempts = 1)
Execute a Closure within a transaction.
at line 102
void
beginTransaction()
Start a new database transaction.
at line 107
void
commit()
Commit the active database transaction.
at line 112
void
rollBack(int|null $toLevel = null)
Rollback the active database transaction.
at line 117
int
transactionLevel()
Get the number of active transactions.
at line 122
array
pretend(Closure $callback)
Execute the given callback in "dry run" mode.
at line 127
string
getDatabaseName()
Get the name of the connected database.
at line 132
string|null
getName()
Get the connection name.
at line 137
string
getDriverName()
Get the database driver name (e.g. "mysql", "pgsql", "sqlite").
at line 142
string
getDriverTitle()
Get a human-readable name for the database driver.
at line 147
int|null
threadCount()
Get the number of open connections to the database.
at line 152
mixed
withoutTablePrefix(Closure $callback)
Run a callback without the table prefix on the connection.
at line 157
Builder
getSchemaBuilder()
Get a schema builder instance for the connection.
at line 162
Grammar
getQueryGrammar()
Get the query grammar used by the connection.
at line 167
Processor
getPostProcessor()
Get the query post processor used by the connection.
at line 172
PDO
getPdo()
Get the current PDO connection.
at line 177
string
getTablePrefix()
Get the table prefix for the connection.
at line 182
string
getServerVersion()
Get the database server version.
at line 187
mixed
getConfig(string|null $option = null)
Get an option from the configuration options.
at line 192
array
selectFromWriteConnection(string $query, array $bindings = [])
Run a select statement against the database using the write connection.
at line 197
void
recordsHaveBeenModified(bool $value = true)
Indicate if any records have been modified.
at line 202
void
disconnect()
Disconnect from the underlying PDO connection.