Connection
class Connection implements ConnectionInterface (View source)
Traits
Methods
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.
Get a new raw query expression.
Run a select statement and return a single result.
Run a select statement against the database.
Run a select statement against the database.
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.
Disconnect from the underlying PDO connection.
Reconnect to the database.
Log a query in the connection's query log.
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 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.
Get the schema grammar used by the connection.
Get the query post processor used by the connection.
Get the event dispatcher used by the connection.
Determine if the connection in a "dry run".
Get the default fetch mode for the connection.
Get the fetch argument to be applied when selecting.
Get custom constructor arguments for the PDO::FETCH_CLASS fetch mode.
Set the default fetch mode for the connection, and optional arguments for the given fetch mode.
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.
Details
at line line 160
void
__construct(
PDO|Closure $pdo,
string $database = '',
string $tablePrefix = '',
array $config = array())
Create a new database connection instance.
at line line 206
void
useDefaultSchemaGrammar()
Set the schema grammar to the default implementation.
at line line 226
void
useDefaultPostProcessor()
Set the query post processor to the default implementation.
at line line 296
mixed
selectOne(
string $query,
array $bindings = array())
Run a select statement and return a single result.
at line line 310
array
selectFromWriteConnection(
string $query,
array $bindings = array())
Run a select statement against the database.
at line line 323
array
select(
string $query,
array $bindings = array(),
bool $useReadPdo = true)
Run a select statement against the database.
at line line 363
bool
insert(
string $query,
array $bindings = array())
Run an insert statement against the database.
at line line 375
int
update(
string $query,
array $bindings = array())
Run an update statement against the database.
at line line 387
int
delete(
string $query,
array $bindings = array())
Run a delete statement against the database.
at line line 399
bool
statement(
string $query,
array $bindings = array())
Execute an SQL statement and return the boolean result.
at line line 419
int
affectingStatement(
string $query,
array $bindings = array())
Run an SQL statement and get the number of rows affected.
at line line 443
bool
unprepared(
string $query)
Run a raw, unprepared query against the PDO connection.
at line line 749
void
logQuery(
string $query,
array $bindings,
float|null $time = null)
Log a query in the connection's query log.
at line line 768
void
listen(
Closure $callback)
Register a database query listener with the connection.
at line line 825
Column
getDoctrineColumn(
string $table,
string $column)
Get a Doctrine Schema Column instance.
at line line 837
AbstractSchemaManager
getDoctrineSchemaManager()
Get the Doctrine DBAL schema manager for the connection.
at line line 847
Connection
getDoctrineConnection()
Get the Doctrine DBAL database connection instance.
at line line 926
$this
setReconnector(
callable $reconnector)
Set the reconnect instance on the connection.
at line line 980
void
setQueryGrammar(
Grammar $grammar)
Set the query grammar used by the connection.
at line line 1001
void
setSchemaGrammar(
Grammar $grammar)
Set the schema grammar used by the connection.
at line line 1022
void
setPostProcessor(
Processor $processor)
Set the query post processor used by the connection.
at line line 1043
void
setEventDispatcher(
Dispatcher $events)
Set the event dispatcher instance on the connection.
at line line 1083
array
getFetchConstructorArgument()
Get custom constructor arguments for the PDO::FETCH_CLASS fetch mode.
at line line 1096
int
setFetchMode(
int $fetchMode,
mixed $fetchArgument = null,
array $fetchConstructorArgument = array())
Set the default fetch mode for the connection, and optional arguments for the given fetch mode.
at line line 1190
void
setTablePrefix(
string $prefix)
Set the table prefix in use by the connection.