class Connection implements ConnectionInterface (View source)
DetectsDeadlocks |
DetectsLostConnections |
ManagesTransactions |
mixed | transaction(Closure $callback, int $attempts = 1) Execute a Closure within a transaction. | from ManagesTransactions |
void | beginTransaction() Start a new database transaction. | from ManagesTransactions |
void | commit() Commit the active database transaction. | from ManagesTransactions |
void | rollBack(int|null $toLevel = null) Rollback the active database transaction. | from ManagesTransactions |
int | transactionLevel() Get the number of active transactions. | from ManagesTransactions |
void | __construct(PDO|Closure $pdo, string $database = '', string $tablePrefix = '', array $config = array()) Create a new database connection instance. | |
void | useDefaultQueryGrammar() Set the query grammar to the default implementation. | |
void | useDefaultSchemaGrammar() Set the schema grammar to the default implementation. | |
void | useDefaultPostProcessor() Set the query post processor to the default implementation. | |
Builder | getSchemaBuilder() Get a schema builder instance for the connection. | |
Builder | table(string $table) Begin a fluent query against a database table. | |
Builder | query() Get a new query builder instance. | |
mixed | selectOne(string $query, array $bindings = array(), bool $useReadPdo = true) Run a select statement and return a single result. | |
array | selectFromWriteConnection(string $query, array $bindings = array()) Run a select statement against the database. | |
array | select(string $query, array $bindings = array(), bool $useReadPdo = true) Run a select statement against the database. | |
Generator | cursor(string $query, array $bindings = array(), bool $useReadPdo = true) Run a select statement against the database and returns a generator. | |
bool | insert(string $query, array $bindings = array()) Run an insert statement against the database. | |
int | update(string $query, array $bindings = array()) Run an update statement against the database. | |
int | delete(string $query, array $bindings = array()) Run a delete statement against the database. | |
bool | statement(string $query, array $bindings = array()) Execute an SQL statement and return the boolean result. | |
int | affectingStatement(string $query, array $bindings = array()) 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. | |
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. | |
void | logQuery(string $query, array $bindings, float|null $time = null) Log a query in the connection's query log. | |
void | reconnect() Reconnect to the database. | |
void | disconnect() Disconnect from the underlying PDO connection. | |
void | listen(Closure $callback) Register a database query listener with the connection. | |
Expression | raw(mixed $value) Get a new raw query expression. | |
bool | isDoctrineAvailable() Is Doctrine available? | |
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. | |
PDO | getPdo() Get the current PDO connection. | |
PDO | getReadPdo() Get the current PDO connection used for reading. | |
$this | setPdo(PDO|null $pdo) Set the PDO connection. | |
$this | setReadPdo(PDO|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. | |
mixed | getConfig(string $option) Get an option from the configuration options. | |
string | getDriverName() Get the PDO driver name. | |
Grammar | getQueryGrammar() Get the query grammar used by the connection. | |
void | setQueryGrammar(Grammar $grammar) Set the query grammar used by the connection. | |
Grammar | getSchemaGrammar() Get the schema grammar used by the connection. | |
void | setSchemaGrammar(Grammar $grammar) Set the schema grammar used by the connection. | |
Processor | getPostProcessor() Get the query post processor used by the connection. | |
void | setPostProcessor(Processor $processor) Set the query post processor used by the connection. | |
Dispatcher | getEventDispatcher() Get the event dispatcher used by the connection. | |
void | setEventDispatcher(Dispatcher $events) Set the event dispatcher instance on the connection. | |
bool | pretending() Determine if the connection in a "dry run". | |
array | getQueryLog() Get the connection query log. | |
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. | |
string | setDatabaseName(string $database) Set the name of the connected database. | |
string | getTablePrefix() Get the table prefix for the connection. | |
void | setTablePrefix(string $prefix) Set the table prefix in use by the connection. | |
Grammar | 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. |
Execute a Closure within a transaction.
Start a new database transaction.
Commit the active database transaction.
Rollback the active database transaction.
Get the number of active transactions.
Create a new database connection instance.
Set the query grammar to the default implementation.
Set the schema grammar to the default implementation.
Set the query post processor to the default implementation.
Get a schema builder instance for the connection.
Begin a fluent query against a database table.
Get a new query builder 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.
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.
Execute the given callback in "dry run" mode.
Bind values to their parameters in the given statement.
Prepare the query bindings for execution.
Log a query in the connection's query log.
Reconnect to the database.
Disconnect from the underlying PDO connection.
Register a database query listener with the connection.
Get a new raw query expression.
Is Doctrine available?
Get a Doctrine Schema Column instance.
Get the Doctrine DBAL schema manager for the connection.
Get the Doctrine DBAL database connection instance.
Get the current PDO connection.
Get the current PDO connection used for reading.
Set the PDO connection.
Set the PDO connection used for reading.
Set the reconnect instance on the connection.
Get the database connection name.
Get an option from the configuration options.
Get the PDO driver name.
Get the query grammar used by the connection.
Set the query grammar used by the connection.
Get the schema grammar used by the connection.
Set the schema grammar used by the connection.
Get the query post processor used by the connection.
Set the query post processor used by the connection.
Get the event dispatcher used by the connection.
Set the event dispatcher instance on the connection.
Determine if the connection in a "dry run".
Get the connection query log.
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.
Get the table prefix for the connection.
Set the table prefix in use by the connection.
Register a connection resolver.
Get the connection resolver for the given driver.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Database/Connection.html