This class contains abstract method definitions for each database driver in CONTENIDO.

package Core
subpackage Database

 Methods

Constructor of the database driver.

__construct(array $dbCfg) : \cDbDriverAbstract

Currently stores the given configuration locally.

Parameters

$dbCfg

array

database configuration

Returns

Returns number of affected rows from last executed query (update, delete)

affectedRows() : int

Returns

intNumber of affected rows

Builds a insert query.

buildInsert(string $tableName, array $fields) : string

String values in passed fields parameter will be escaped automatically.

Parameters

$tableName

string

The table name

$fields

array

Associative array of fields to insert

Returns

stringThe INSERT SQL query

Builds a update query.

buildUpdate(string $tableName, array $fields, array $whereClauses) : string

String values in passed fields and whereClauses parameter will be escaped automatically.

Parameters

$tableName

string

The table name

$fields

array

Assoziative array of fields to update

$whereClauses

array

Assoziative array of field in where clause. Multiple entries will be concatenated with AND

Returns

stringThe UPDATE query

Abstract method for checking database driver base functions.

check() : bool

If this check fails, the database connection will not be established.

Returns

bool

Connects to the database.

connect() : object | resource | int | null

Returns

objectresourceintnullConnection handler. Return value depends on used driver and is null in case of an error.

Closes the connection and frees the query id.

disconnect() : void

Escape string for using in SQL-Statement.

escape(string $string) : string

Parameters

$string

string

The string to escape

Returns

stringEscaped string

Discard the query result

free() : int

Returns

int

Returns error message of last occured error by using databases interface.

getErrorMessage() : string

Returns

string

Returns error code of last occured error by using databases interface.

getErrorNumber() : int

Returns

int

Returns the database driver handler instance.

getHandler() : \cDbDriverHandler | null

Returns

This method returns the current result set as object or null if no result set is left.

getResultObject($className) : object

If optional param $className is set, the result object is an instance of class $className.

Parameters

$className

Returns

object

Fetches server information.

getServerInfo() : array

Returns

array

Fetches all table names.

getTableNames() : array

Returns

array

Moves the result to the next record, if exists and returns the status of the movement

nextRecord() : int

Returns

intFlag about move status 1 on success or 0

Returns the number of fields (columns) from current record set

numFields() : int

Returns

intNumber of fields

Returns the number of rows from last executed select query.

numRows() : int

Returns

intThe number of rows from last select query result

Executes the query.

query(string $statement) : void

Parameters

$statement

string

The query to execute

Moves the cursor (position inside current result sets).

seek(int $iPos) : void

Parameters

$iPos

int

The positon to move to inside the current result set

Sets the database driver handler.

setHandler(\cDbDriverHandler $handler) : void

Parameters

$handler

\cDbDriverHandler

database driver handler instance

 Properties

 

$_dbCfg : array
 

$_handler : \cDbDriverHandler