Interface ConnectionInterface

Summary

Fully Qualified Name: CodeIgniter\Database\ConnectionInterface

Description

Interface ConnectionInterface

Methods

Name Description Defined By
callFunction() Allows for custom calls to the database engine that are not supported through our database layer. ConnectionInterface
connect() Connect to the database. ConnectionInterface
escape() "Smart" Escaping ConnectionInterface
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. ConnectionInterface
getDatabase() Returns the name of the current database being used. ConnectionInterface
getError() Returns the last error encountered by this connection. ConnectionInterface
getLastQuery() Returns the last query's statement object. ConnectionInterface
getPlatform() The name of the platform in use (MySQLi, mssql, etc) ConnectionInterface
getVersion() Returns a string containing the version of the database being used. ConnectionInterface
initialize() Initializes the database connection/settings. ConnectionInterface
persistentConnect() Create a persistent database connection. ConnectionInterface
query() Orchestrates a query against the database. Queries must use Database\Statement objects to store the query and build it. ConnectionInterface
reconnect() Keep or establish the connection if no queries have been sent for a length of time exceeding the server's idle timeout. ConnectionInterface
setDatabase() Select a specific database table to use. ConnectionInterface
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. ConnectionInterface
table() Returns an instance of the query builder for this connection. ConnectionInterface

Method Details

callFunction()

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

Parameter Name Type Description
$functionName string
...$params array
$params

Returns: mixed

connect()

Connect to the database.

Parameter Name Type Description
$persistent bool

Returns: mixed

escape()

"Smart" Escaping

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

Parameter Name Type Description
$str mixed

Returns: 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.

Parameter Name Type Description
$alias string|null

Returns: mixed

getDatabase()

Returns the name of the current database being used.

Returns: string

getError()

Returns the last error encountered by this connection.

Returns: mixed

getLastQuery()

Returns the last query's statement object.

Returns: mixed

getPlatform()

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

Returns: string

getVersion()

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

Returns: string

initialize()

Initializes the database connection/settings.

Returns: mixed

persistentConnect()

Create a persistent database connection.

Returns: mixed

query()

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.

Parameter Name Type Description
$sql string
...$binds mixed
$binds

Returns: mixed

reconnect()

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

Returns: mixed

setDatabase()

Select a specific database table to use.

Parameter Name Type Description
$databaseName string

Returns: 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.

Parameter Name Type Description
$sql string

Returns: mixed

table()

Returns an instance of the query builder for this connection.

Parameter Name Type Description
$tableName string|array Table

Returns: \BaseBuilder Builder.

Top