Methods |
final
protected
|
openDb(string $filename, ?string $query = null): $this
Open the database, creating it if necessary
Open the database, creating it if necessary
Parameters
$filename |
Use ":memory:" to create an in-memory database,
or an empty string to create a temporary database on the filesystem.
Otherwise, $filename is created with file mode 0600 if it doesn't
exist. Its parent directory is created with mode 0700 if it doesn't
exist.
|
Throws
|
#
|
final
public
|
unload(): void
Close the object's underlying resources
Close the object's underlying resources
Implements
|
#
|
public
|
close(): void
Close the database and unload any facades where the store is the
underlying instance
Close the database and unload any facades where the store is the
underlying instance
Overriden by
|
#
|
final
protected
|
closeDb(): void
If the database is open, close it, and unload any facades where the store
is the underlying instance
If the database is open, close it, and unload any facades where the store
is the underlying instance
|
#
|
public
|
detach(): void
Close the store without closing the database by detaching the database
from the store, and unload any facades where theā¦
Close the store without closing the database by detaching the database
from the store, and unload any facades where the store is the underlying
instance
|
#
|
final
protected
|
detachDb(): void
Detach the database from the store and unload any facades where the store
is the underlying instance
Detach the database from the store and unload any facades where the store
is the underlying instance
|
#
|
protected
|
check(): $this
Override to perform an action whenever the underlying SQLite3 instance is
accessed
Override to perform an action whenever the underlying SQLite3 instance is
accessed
Called once per call to {@see AbstractStore::db()}. Use
{@see AbstractStore::safeCheck()} to prevent recursion if necessary.
Overriden by
|
#
|
final
public
|
isOpen(): bool
Check if the database is open
Check if the database is open
|
#
|
final
public
|
isTemporary(): bool
Check if the store is backed by a temporary or in-memory database
Check if the store is backed by a temporary or in-memory database
Throws
|
#
|
final
public
|
getFilename(): string
Get the filename of the database
Get the filename of the database
Throws
|
#
|
final
protected
|
isCheckRunning(): bool
Check if safeCheck() is currently running
Check if safeCheck() is currently running
|
#
|
final
protected
|
safeCheck(): $this
Call check() without recursion
Call check() without recursion
{@see AbstractStore::db()} calls {@see AbstractStore::check()} via
{@see AbstractStore::safeCheck()} to prevent recursion when
{@see AbstractStore::check()} calls {@see AbstractStore::db()}.
If {@see AbstractStore::check()} may be called directly, it should call
itself via {@see AbstractStore::safeCheck()}, for example:
protected function check()
{
if (!$this->isCheckRunning()) {
return $this->safeCheck();
}
// ...
}
|
#
|
final
protected
|
db(): SQLite3
Get the underlying SQLite3 instance
Get the underlying SQLite3 instance
Throws
|
#
|
final
protected
|
prepare(string $query): SQLite3Stmt
Prepare a SQL statement for execution
Prepare a SQL statement for execution
|
#
|
final
protected
|
execute(SQLite3Stmt $stmt): SQLite3Result
Execute a prepared statement
Execute a prepared statement
|
#
|
final
protected
|
hasTransaction(): bool
Check if a transaction has been started
Check if a transaction has been started
|
#
|
final
protected
|
beginTransaction(): $this
BEGIN a transaction
|
#
|
final
protected
|
commitTransaction(): $this
COMMIT a transaction
|
#
|
final
protected
|
rollbackTransaction(bool $ignoreNoTransaction = false): $this
ROLLBACK a transaction
Parameters
$ignoreNoTransaction |
If true and no transaction has been
started, return without throwing an exception. Useful in catch blocks
where a transaction may or may not have been started.
|
Throws
|
#
|
final
protected
|
callInTransaction<T>(callable(): T $callback): T
BEGIN a transaction, run a callback and COMMIT or ROLLBACK as needed
BEGIN a transaction, run a callback and COMMIT or ROLLBACK as needed
A rollback is attempted if an exception is caught, otherwise the
transaction is committed.
Throws
|
#
|
final
protected
|
assertCanUpsert(): void
Throw an exception if the underlying SQLite3 library doesn't support
UPSERT queries
Throw an exception if the underlying SQLite3 library doesn't support
UPSERT queries
|
#
|
final
protected
|
assertIsOpen(): void
Throw an exception if the database is not open
Throw an exception if the database is not open
|
#
|