\CodeIgniter\DatabaseConnectionInterface

Interface ConnectionInterface

Summary

Methods
Constants
initialize()
connect()
persistentConnect()
reconnect()
getConnection()
setDatabase()
getDatabase()
getError()
getPlatform()
getVersion()
query()
simpleQuery()
table()
getLastQuery()
escape()
callFunction()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

initialize()

initialize() : mixed

Initializes the database connection/settings.

Returns

mixed

connect()

connect(boolean  $persistent = false) : mixed

Connect to the database.

Parameters

boolean $persistent

Returns

mixed

persistentConnect()

persistentConnect() : mixed

Create a persistent database connection.

Returns

mixed

reconnect()

reconnect() : mixed

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

Returns

mixed

getConnection()

getConnection(string|null  $alias = null) : 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.

Parameters

string|null $alias

Returns

mixed

setDatabase()

setDatabase(string  $databaseName) : mixed

Select a specific database table to use.

Parameters

string $databaseName

Returns

mixed

getDatabase()

getDatabase() : string

Returns the name of the current database being used.

Returns

string

getError()

getError() : mixed

Returns the last error encountered by this connection.

Returns

mixed

getPlatform()

getPlatform() : string

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

Returns

string

getVersion()

getVersion() : string

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

Returns

string

query()

query(string  $sql, mixed  ...$binds) : mixed

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

This method works with the cache.

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

Parameters

string $sql
mixed $binds variadic

Returns

mixed

simpleQuery()

simpleQuery(string  $sql) : 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.

Parameters

string $sql

Returns

mixed

table()

table(string|array  $tableName) : \CodeIgniter\Database\BaseBuilder

Returns an instance of the query builder for this connection.

Parameters

string|array $tableName

Table name.

Returns

\CodeIgniter\Database\BaseBuilder —

Builder.

getLastQuery()

getLastQuery() : mixed

Returns the last query's statement object.

Returns

mixed

escape()

escape(mixed  $str) : mixed

"Smart" Escaping

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

Parameters

mixed $str

Returns

mixed

callFunction()

callFunction(string  $functionName, array  ...$params) : mixed

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

Parameters

string $functionName
array $params variadic

Returns

mixed