Methods |
public
|
__construct(PDO|Closure $pdo, string $database = '', string $tablePrefix = '', array $config = []): void
Create a new database connection instance.
Create a new database connection instance.
|
#
|
public
|
useDefaultQueryGrammar(): void
Set the query grammar to the default implementation.
Set the query grammar to the default implementation.
|
#
|
public
|
useDefaultSchemaGrammar(): void
Set the schema grammar to the default implementation.
Set the schema grammar to the default implementation.
|
#
|
public
|
useDefaultPostProcessor(): void
Set the query post processor to the default implementation.
Set the query post processor to the default implementation.
|
#
|
public
|
getSchemaBuilder(): Builder
Get a schema builder instance for the connection.
Get a schema builder instance for the connection.
|
#
|
public
|
table(Closure|Builder|string $table, string|null $as = null): Builder
Begin a fluent query against a database table.
Begin a fluent query against a database table.
Implements
|
#
|
public
|
query(): Builder
Get a new query builder instance.
Get a new query builder instance.
|
#
|
public
|
selectOne(string $query, array $bindings = [], bool $useReadPdo = true): mixed
Run a select statement and return a single result.
Run a select statement and return a single result.
Implements
|
#
|
public
|
selectFromWriteConnection(string $query, array $bindings = []): array
Run a select statement against the database.
Run a select statement against the database.
|
#
|
public
|
select(string $query, array $bindings = [], bool $useReadPdo = true): array
Run a select statement against the database.
Run a select statement against the database.
Implements
|
#
|
public
|
cursor(string $query, array $bindings = [], bool $useReadPdo = true): Generator
Run a select statement against the database and returns a generator.
Run a select statement against the database and returns a generator.
Implements
|
#
|
public
|
insert(string $query, array $bindings = []): bool
Run an insert statement against the database.
Run an insert statement against the database.
Implements
|
#
|
public
|
update(string $query, array $bindings = []): int
Run an update statement against the database.
Run an update statement against the database.
Implements
|
#
|
public
|
delete(string $query, array $bindings = []): int
Run a delete statement against the database.
Run a delete statement against the database.
Implements
|
#
|
public
|
statement(string $query, array $bindings = []): bool
Execute an SQL statement and return the boolean result.
Execute an SQL statement and return the boolean result.
Implements
|
#
|
public
|
affectingStatement(string $query, array $bindings = []): int
Run an SQL statement and get the number of rows affected.
Run an SQL statement and get the number of rows affected.
Implements
|
#
|
public
|
unprepared(string $query): bool
Run a raw, unprepared query against the PDO connection.
Run a raw, unprepared query against the PDO connection.
Implements
|
#
|
public
|
pretend(Closure $callback): array
Execute the given callback in "dry run" mode.
Execute the given callback in "dry run" mode.
Implements
|
#
|
public
|
bindValues(PDOStatement $statement, array $bindings): void
Bind values to their parameters in the given statement.
Bind values to their parameters in the given statement.
|
#
|
public
|
prepareBindings(array $bindings): array
Prepare the query bindings for execution.
Prepare the query bindings for execution.
Implements
|
#
|
public
|
logQuery(string $query, array $bindings, float|null $time = null): void
Log a query in the connection's query log.
Log a query in the connection's query log.
|
#
|
public
|
reconnect(): void
Reconnect to the database.
Reconnect to the database.
Throws
|
#
|
public
|
disconnect(): void
Disconnect from the underlying PDO connection.
Disconnect from the underlying PDO connection.
|
#
|
public
|
beforeExecuting(Closure $callback): $this
Register a hook to be run just before a database query is executed.
Register a hook to be run just before a database query is executed.
|
#
|
public
|
listen(Closure $callback): void
Register a database query listener with the connection.
Register a database query listener with the connection.
|
#
|
public
|
raw(mixed $value): Expression
Get a new raw query expression.
Get a new raw query expression.
Implements
|
#
|
public
|
hasModifiedRecords(): bool
Determine if the database connection has modified any database records.
Determine if the database connection has modified any database records.
|
#
|
public
|
recordsHaveBeenModified(bool $value = true): void
Indicate if any records have been modified.
Indicate if any records have been modified.
|
#
|
public
|
setRecordModificationState(bool $value): $this
Set the record modification state.
Set the record modification state.
|
#
|
public
|
forgetRecordModificationState(): void
Reset the record modification state.
Reset the record modification state.
|
#
|
public
|
useWriteConnectionWhenReading(bool $value = true): $this
Indicate that the connection should use the write PDO connection for reads.
Indicate that the connection should use the write PDO connection for reads.
|
#
|
public
|
isDoctrineAvailable(): bool
Is Doctrine available?
|
#
|
public
|
getDoctrineColumn(string $table, string $column): Column
Get a Doctrine Schema Column instance.
Get a Doctrine Schema Column instance.
|
#
|
public
|
getDoctrineSchemaManager(): AbstractSchemaManager
Get the Doctrine DBAL schema manager for the connection.
Get the Doctrine DBAL schema manager for the connection.
|
#
|
public
|
getDoctrineConnection(): Connection
Get the Doctrine DBAL database connection instance.
Get the Doctrine DBAL database connection instance.
|
#
|
public
|
registerDoctrineType(string $class, string $name, string $type): void
Register a custom Doctrine mapping type.
Register a custom Doctrine mapping type.
Throws
|
#
|
public
|
getPdo(): PDO
Get the current PDO connection.
Get the current PDO connection.
|
#
|
public
|
getRawPdo(): PDO|Closure|null
Get the current PDO connection parameter without executing any reconnect logic.
Get the current PDO connection parameter without executing any reconnect logic.
|
#
|
public
|
getReadPdo(): PDO
Get the current PDO connection used for reading.
Get the current PDO connection used for reading.
|
#
|
public
|
getRawReadPdo(): PDO|Closure|null
Get the current read PDO connection parameter without executing any reconnect logic.
Get the current read PDO connection parameter without executing any reconnect logic.
|
#
|
public
|
setPdo(PDO|Closure|null $pdo): $this
Set the PDO connection.
|
#
|
public
|
setReadPdo(PDO|Closure|null $pdo): $this
Set the PDO connection used for reading.
Set the PDO connection used for reading.
|
#
|
public
|
setReconnector(callable $reconnector): $this
Set the reconnect instance on the connection.
Set the reconnect instance on the connection.
|
#
|
public
|
getName(): string|null
Get the database connection name.
Get the database connection name.
|
#
|
public
|
getNameWithReadWriteType(): string|null
Get the database connection full name.
Get the database connection full name.
|
#
|
public
|
getConfig(string|null $option = null): mixed
Get an option from the configuration options.
Get an option from the configuration options.
|
#
|
public
|
getDriverName(): string
Get the PDO driver name.
|
#
|
public
|
getQueryGrammar(): Grammar
Get the query grammar used by the connection.
Get the query grammar used by the connection.
|
#
|
public
|
setQueryGrammar(Grammar $grammar): $this
Set the query grammar used by the connection.
Set the query grammar used by the connection.
|
#
|
public
|
getSchemaGrammar(): Grammar
Get the schema grammar used by the connection.
Get the schema grammar used by the connection.
|
#
|
public
|
setSchemaGrammar(Grammar $grammar): $this
Set the schema grammar used by the connection.
Set the schema grammar used by the connection.
|
#
|
public
|
getPostProcessor(): Processor
Get the query post processor used by the connection.
Get the query post processor used by the connection.
|
#
|
public
|
setPostProcessor(Processor $processor): $this
Set the query post processor used by the connection.
Set the query post processor used by the connection.
|
#
|
public
|
getEventDispatcher(): Dispatcher
Get the event dispatcher used by the connection.
Get the event dispatcher used by the connection.
|
#
|
public
|
setEventDispatcher(Dispatcher $events): $this
Set the event dispatcher instance on the connection.
Set the event dispatcher instance on the connection.
|
#
|
public
|
unsetEventDispatcher(): void
Unset the event dispatcher for this connection.
Unset the event dispatcher for this connection.
|
#
|
public
|
setTransactionManager(DatabaseTransactionsManager $manager): $this
Set the transaction manager instance on the connection.
Set the transaction manager instance on the connection.
|
#
|
public
|
unsetTransactionManager(): void
Unset the transaction manager for this connection.
Unset the transaction manager for this connection.
|
#
|
public
|
pretending(): bool
Determine if the connection is in a "dry run".
Determine if the connection is in a "dry run".
|
#
|
public
|
getQueryLog(): array
Get the connection query log.
Get the connection query log.
|
#
|
public
|
flushQueryLog(): void
Clear the query log.
|
#
|
public
|
enableQueryLog(): void
Enable the query log on the connection.
Enable the query log on the connection.
|
#
|
public
|
disableQueryLog(): void
Disable the query log on the connection.
Disable the query log on the connection.
|
#
|
public
|
logging(): bool
Determine whether we're logging queries.
Determine whether we're logging queries.
|
#
|
public
|
getDatabaseName(): string
Get the name of the connected database.
Get the name of the connected database.
Implements
|
#
|
public
|
setDatabaseName(string $database): $this
Set the name of the connected database.
Set the name of the connected database.
|
#
|
public
|
setReadWriteType(string|null $readWriteType): $this
Set the read / write type of the connection.
Set the read / write type of the connection.
|
#
|
public
|
getTablePrefix(): string
Get the table prefix for the connection.
Get the table prefix for the connection.
|
#
|
public
|
setTablePrefix(string $prefix): $this
Set the table prefix in use by the connection.
Set the table prefix in use by the connection.
|
#
|
public
|
withTablePrefix(Grammar $grammar): Grammar
Set the table prefix and return the grammar.
Set the table prefix and return the grammar.
|
#
|
public
static
|
resolverFor(string $driver, Closure $callback): void
Register a connection resolver.
Register a connection resolver.
|
#
|
public
static
|
getResolver(string $driver): mixed
Get the connection resolver for the given driver.
Get the connection resolver for the given driver.
|
#
|