ConnectionInterface
in
Tags
Table of Contents
Methods
- callFunction() : array<string|int, mixed>|bool|float|int|object|resource|string|null
- Allows for custom calls to the database engine that are not supported through our database layer.
- connect() : false|object|resource
- Connect to the database.
- error() : array<string, int|string>
- Returns the last error encountered by this connection.
- escape() : array<string|int, mixed>|float|int|string
- "Smart" Escaping
- getConnection() : false|object|resource
- 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() : Query
- 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() : void
- Initializes the database connection/settings.
- isWriteType() : bool
- Determines if the statement is a write-type query or not.
- persistentConnect() : false|object|resource
- Create a persistent database connection.
- query() : BaseResult|bool|Query
- Orchestrates a query against the database. Queries must use Database\Statement objects to store the query and build it.
- reconnect() : void
- Keep or establish the connection if no queries have been sent for a length of time exceeding the server's idle timeout.
- setDatabase() : bool
- Select a specific database table to use.
- simpleQuery() : false|object|resource
- 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) : array<string|int, mixed>|bool|float|int|object|resource|string|null
Parameters
- $functionName : string
- $params : array<string|int, mixed>
Return values
array<string|int, mixed>|bool|float|int|object|resource|string|nullconnect()
Connect to the database.
public
connect([bool $persistent = false ]) : false|object|resource
Parameters
- $persistent : bool = false
Tags
Return values
false|object|resourceerror()
Returns the last error encountered by this connection.
public
error() : array<string, int|string>
Must return this format: ['code' => string|int, 'message' => string] intval(code) === 0 means "no error".
Return values
array<string, int|string>escape()
"Smart" Escaping
public
escape(array<string|int, mixed>|bool|float|int|object|string|null $str) : array<string|int, mixed>|float|int|string
Escapes data based on type. Sets boolean and null types.
Parameters
- $str : array<string|int, mixed>|bool|float|int|object|string|null
Tags
Return values
array<string|int, mixed>|float|int|stringgetConnection()
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 ]) : false|object|resource
Parameters
- $alias : string|null = null
Tags
Return values
false|object|resourcegetDatabase()
Returns the name of the current database being used.
public
getDatabase() : string
Return values
stringgetLastQuery()
Returns the last query's statement object.
public
getLastQuery() : Query
Return values
QuerygetPlatform()
The name of the platform in use (MySQLi, mssql, etc)
public
getPlatform() : string
Return values
stringgetVersion()
Returns a string containing the version of the database being used.
public
getVersion() : string
Return values
stringinitialize()
Initializes the database connection/settings.
public
initialize() : void
isWriteType()
Determines if the statement is a write-type query or not.
public
isWriteType(string $sql) : bool
Parameters
- $sql : string
Return values
boolpersistentConnect()
Create a persistent database connection.
public
persistentConnect() : false|object|resource
Tags
Return values
false|object|resourcequery()
Orchestrates a query against the database. Queries must use Database\Statement objects to store the query and build it.
public
query(string $sql[, array<string|int, mixed>|string|null $binds = null ]) : BaseResult|bool|Query
This method works with the cache.
Should automatically handle different connections for read/write queries if needed.
Parameters
- $sql : string
- $binds : array<string|int, mixed>|string|null = null
Tags
Return values
BaseResult|bool|Queryreconnect()
Keep or establish the connection if no queries have been sent for a length of time exceeding the server's idle timeout.
public
reconnect() : void
setDatabase()
Select a specific database table to use.
public
setDatabase(string $databaseName) : bool
Parameters
- $databaseName : string
Return values
boolsimpleQuery()
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) : false|object|resource
Parameters
- $sql : string
Tags
Return values
false|object|resourcetable()
Returns an instance of the query builder for this connection.
public
table(array<string|int, mixed>|string $tableName) : BaseBuilder
Parameters
- $tableName : array<string|int, mixed>|string
-
Table name.
Return values
BaseBuilder —Builder.