Documentation

ConnectionInterface

Interface ConnectionInterface

Table of Contents

callFunction()  : mixed
Allows for custom calls to the database engine that are not supported through our database layer.
connect()  : mixed
Connect to the database.
error()  : array<string, string|int>
Returns the last error encountered by this connection.
escape()  : mixed
"Smart" Escaping
getConnection()  : mixed
Returns the actual connection object. If both a 'read' and 'write' connection has been specified, you can pass either term in to get that connection. If you pass either alias in and only a single connection is present, it must return the sole connection.
getDatabase()  : string
Returns the name of the current database being used.
getLastQuery()  : mixed
Returns the last query's statement object.
getPlatform()  : string
The name of the platform in use (MySQLi, mssql, etc)
getVersion()  : string
Returns a string containing the version of the database being used.
initialize()  : mixed
Initializes the database connection/settings.
isWriteType()  : bool
Determines if the statement is a write-type query or not.
persistentConnect()  : mixed
Create a persistent database connection.
query()  : BaseResult|Query|bool
Orchestrates a query against the database. Queries must use Database\Statement objects to store the query and build it.
reconnect()  : mixed
Keep or establish the connection if no queries have been sent for a length of time exceeding the server's idle timeout.
setDatabase()  : mixed
Select a specific database table to use.
simpleQuery()  : mixed
Performs a basic query against the database. No binding or caching is performed, nor are transactions handled. Simply takes a raw query string and returns the database-specific result id.
table()  : BaseBuilder
Returns an instance of the query builder for this connection.

Methods

callFunction()

Allows for custom calls to the database engine that are not supported through our database layer.

public callFunction(string $functionName, array<string|int, mixed> ...$params) : mixed
Parameters
$functionName : string
$params : array<string|int, mixed>
Return values
mixed

connect()

Connect to the database.

public connect([bool $persistent = false ]) : mixed
Parameters
$persistent : bool = false
Return values
mixed

error()

Returns the last error encountered by this connection.

public error() : array<string, string|int>

Must return this format: ['code' => string|int, 'message' => string] intval(code) === 0 means "no error".

Return values
array<string, string|int>

escape()

"Smart" Escaping

public escape(mixed $str) : mixed

Escapes data based on type. Sets boolean and null types.

Parameters
$str : mixed
Return values
mixed

getConnection()

Returns the actual connection object. If both a 'read' and 'write' connection has been specified, you can pass either term in to get that connection. If you pass either alias in and only a single connection is present, it must return the sole connection.

public getConnection([string|null $alias = null ]) : mixed
Parameters
$alias : string|null = null
Return values
mixed

getDatabase()

Returns the name of the current database being used.

public getDatabase() : string
Return values
string

getLastQuery()

Returns the last query's statement object.

public getLastQuery() : mixed
Return values
mixed

getPlatform()

The name of the platform in use (MySQLi, mssql, etc)

public getPlatform() : string
Return values
string

getVersion()

Returns a string containing the version of the database being used.

public getVersion() : string
Return values
string

initialize()

Initializes the database connection/settings.

public initialize() : mixed
Return values
mixed

isWriteType()

Determines if the statement is a write-type query or not.

public isWriteType(string $sql) : bool
Parameters
$sql : string
Return values
bool

persistentConnect()

Create a persistent database connection.

public persistentConnect() : mixed
Return values
mixed

query()

Orchestrates a query against the database. Queries must use Database\Statement objects to store the query and build it.

public query(string $sql, mixed ...$binds) : BaseResult|Query|bool

This method works with the cache.

Should automatically handle different connections for read/write queries if needed.

Parameters
$sql : string
$binds : mixed
Return values
BaseResult|Query|bool

reconnect()

Keep or establish the connection if no queries have been sent for a length of time exceeding the server's idle timeout.

public reconnect() : mixed
Return values
mixed

setDatabase()

Select a specific database table to use.

public setDatabase(string $databaseName) : mixed
Parameters
$databaseName : string
Return values
mixed

simpleQuery()

Performs a basic query against the database. No binding or caching is performed, nor are transactions handled. Simply takes a raw query string and returns the database-specific result id.

public simpleQuery(string $sql) : mixed
Parameters
$sql : string
Return values
mixed

table()

Returns an instance of the query builder for this connection.

public table(string|array<string|int, mixed> $tableName) : BaseBuilder
Parameters
$tableName : string|array<string|int, mixed>

Table name.

Return values
BaseBuilder

Builder.

Search results