This class contains functions for database interaction based on MySQLi in CONTENIDO.
Configurable via global $cfg['db']['connection'] configuration as follows:
- host (string) Hostname or ip - database (string) Database name - user (string) User name - password (string) User password - options (array) Optional, MySQLi options array - socket (int) Optional, socket - port (int) Optional, port - flags (int) Optional, flags - charset (string) Optional, connection charset see http://www.php.net/manual/en/mysqli.real-connect.php
package | Core |
---|---|
subpackage | Database |
__construct(array $dbCfg) : \cDbDriverAbstract
Currently stores the given configuration locally.
inherited_from | \cDbDriverAbstract::__construct() |
---|
array
database configuration
affectedRows() : int
buildInsert(string $tableName, array $fields) : string
String values in passed fields parameter will be escaped automatically.
see | \cDbDriverAbstract::buildInsert |
---|
string
The table name
array
Associative array of fields to insert
string
The INSERT SQL querybuildUpdate(string $tableName, array $fields, array $whereClauses) : string
String values in passed fields and whereClauses parameter will be escaped automatically.
see | \cDbDriverAbstract::buildUpdate |
---|
string
The table name
array
Assoziative array of fields to update
array
Assoziative array of field in where clause. Multiple entries will be concatenated with AND
string
The UPDATE querycheck() : bool
If this check fails, the database connection will not be established.
see | \cDbDriverAbstract::check |
---|
bool
connect() : object | resource | int | null
see | \cDbDriverAbstract::connect |
---|
object
resource
int
null
Connection handler. Return value depends on
used driver and is null in case of an error.disconnect() : void
escape(string $string) : string
see | \cDbDriverAbstract::escape |
---|
string
The string to escape
string
Escaped stringgetErrorMessage() : string
getErrorNumber() : int
getMetaData(string $tableName, bool $full) : array
Due to compatibility problems with Table we changed the behavior of metadata(); depending on $full, metadata returns the following values:
full is false (default): $result[]: [0]["table"] table name [0]["name"] field name [0]["type"] field type [0]["len"] field length [0]["flags"] field flags
full is true $result[]: ["num_fields"] number of metadata records [0]["table"] table name [0]["name"] field name [0]["type"] field type [0]["len"] field length [0]["flags"] field flags ["meta"][field name] index of field named "field name" This last one could be used if you have a field name, but no index. Test: if (isset($result['meta']['myfield'])) { ...
see | \cDbDriverAbstract::getMetaData |
---|
string
The table to get metadata or empty string to retrieve metadata of all tables
bool
Flag to load full metadata
array
Depends on used database and on parameter $fullgetResultObject($className) : object
If optional param $className is set, the result object is an instance of class $className.
see | \cDbDriverAbstract::getResultObject |
---|
object
getServerInfo() : array
getTableNames() : array
nextRecord() : int
numFields() : int
numRows() : int
seek($pos) : void
setHandler(\cDbDriverHandler $handler) : void
inherited_from | \cDbDriverAbstract::setHandler() |
---|
$_dataTypes
$_dbCfg : array
inherited_from | \cDbDriverAbstract::$$_dbCfg |
---|