ConnectionInterface
interface ConnectionInterface
Methods
Get a new raw query expression.
Escape a value for safe SQL embedding.
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 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.
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.
Determine whether the connection has an active physical transaction.
Get the name of the connected database.
Get the connection name.
Get the database connection with its read / write type.
Get the connection name to retain when subsequent operations may write.
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 driver resources.
Details
at line 26
Builder
table(Closure|Builder|Builder|Relation|Expression|UnitEnum|string $table, string|null $as = null)
Begin a fluent query against a database table.
at line 31
Expression
raw(mixed $value)
Get a new raw query expression.
at line 36
string
escape(mixed $value, bool $binary = false)
Escape a value for safe SQL embedding.
at line 41
mixed
selectOne(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement and return a single result.
at line 48
mixed
scalar(string $query, array $bindings = [], bool $useReadPdo = true)
Run a select statement and return the first column of the first row.
at line 53
array
select(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])
Run a select statement against the database.
at line 60
Generator
cursor(string $query, array $bindings = [], bool $useReadPdo = true, array $fetchUsing = [])
Run a select statement against the database and return a generator.
at line 65
bool
insert(string $query, array $bindings = [])
Run an insert statement against the database.
at line 70
int|string
getLastInsertId(string|null $sequence = null)
Get the last insert ID.
at line 75
int
update(string $query, array $bindings = [])
Run an update statement against the database.
at line 80
int
delete(string $query, array $bindings = [])
Run a delete statement against the database.
at line 85
bool
statement(string $query, array $bindings = [])
Execute an SQL statement and return the boolean result.
at line 90
int
affectingStatement(string $query, array $bindings = [])
Run an SQL statement and get the number of rows affected.
at line 95
bool
unprepared(string $query)
Run a raw, unprepared query against the connection.
at line 100
array
prepareBindings(array $bindings)
Prepare the query bindings for execution.
at line 112
mixed
transaction(Closure $callback, int $attempts = 1)
Execute a Closure within a transaction.
at line 117
void
beginTransaction()
Start a new database transaction.
at line 122
void
commit()
Commit the active database transaction.
at line 127
void
rollBack(int|null $toLevel = null)
Rollback the active database transaction.
at line 134
int
transactionLevel()
Get the number of active transactions.
at line 139
bool
inTransaction()
Determine whether the connection has an active physical transaction.
at line 144
array
pretend(Closure $callback)
Execute the given callback in "dry run" mode.
at line 149
string
getDatabaseName()
Get the name of the connected database.
at line 154
string|null
getName()
Get the connection name.
at line 159
string|null
getNameWithReadWriteType()
Get the database connection with its read / write type.
at line 164
string|null
getWritableName()
Get the connection name to retain when subsequent operations may write.
at line 169
string
getDriverName()
Get the database driver name (e.g. "mysql", "pgsql", "sqlite").
at line 174
string
getDriverTitle()
Get a human-readable name for the database driver.
at line 179
int|null
threadCount()
Get the number of open connections to the database.
at line 189
mixed
withoutTablePrefix(Closure $callback)
Run a callback without the table prefix on the connection.
at line 194
Builder
getSchemaBuilder()
Get a schema builder instance for the connection.
at line 199
Grammar
getQueryGrammar()
Get the query grammar used by the connection.
at line 204
Processor
getPostProcessor()
Get the query post processor used by the connection.
at line 209
string
getTablePrefix()
Get the table prefix for the connection.
at line 214
string
getServerVersion()
Get the database server version.
at line 219
mixed
getConfig(string|null $option = null)
Get an option from the configuration options.
at line 224
array
selectFromWriteConnection(string $query, array $bindings = [])
Run a select statement against the database using the write connection.
at line 229
void
recordsHaveBeenModified(bool $value = true)
Indicate if any records have been modified.
at line 234
void
disconnect()
Disconnect from the underlying driver resources.