Properties

$resConnection

$resConnection : 

Type

$resResult

$resResult : 

Type

$strQuery

$strQuery : 

Type

$blnDisableAutocommit

$blnDisableAutocommit : 

Type

$blnDieGracefully

$blnDieGracefully : 

Type

$objLogger

$objLogger : 

Type

$strTablePrefix

$strTablePrefix : 

Type

$strDebugPrefix

$strDebugPrefix : 

Type

$arrParams

$arrParams : 

Type

$arrParamsList

$arrParamsList : 

Type

Methods

__construct()

__construct(  $resConnection,   $strTablePrefix,   $strDebugPrefix,   $blnDisableAutocommit = false) 

Validate the connection resource and store the query

Parameters

$resConnection
$strTablePrefix
$strDebugPrefix
$blnDisableAutocommit

Throws

\Exception

__get()

__get(  $strKey) : mixed

Return a parameter

Supported parameters:

  • query: current query string
  • error: last error message
  • affectedRows: number of affected rows
  • insertId: last insert ID

Throw an exception on requests for protected properties.

Parameters

$strKey

Returns

mixed

prepare()

prepare(  $strQuery) : \Database_Statement

Prepare a statement

Parameters

$strQuery

Throws

\Exception

Returns

\Database_Statement

set()

set(  $arrParams) : \Database_Statement

Take an associative array and auto-generate the SET/VALUES subpart of a query

Usage example: $objStatement->prepare("UPDATE table %s")->set(array('id'=>'my_id')); will be transformed into "UPDATE table SET id='my_id'".

Parameters

$arrParams

Returns

\Database_Statement

in()

in(  $arrParams) : \Database_Statement

Create an IN-Statement

Usage example: $objStatement->prepare("UPDATE table SET a=4 WHERE id :in")->set(array(1, 3, 4)); will be transformed into "UPDATE table SET a=4 WHERE id IN(1,3,4);".

Parameters

$arrParams

Returns

\Database_Statement

limit()

limit(  $intRows,   $intOffset) : \Database_Statement

Limit the current result to a certain number of rows and take an offset value as second argument

Parameters

$intRows
$intOffset

Returns

\Database_Statement

execute()

execute() : \Database_Result

Execute the current statement

Throws

\Exception

Returns

\Database_Result

query()

query(  $strQuery = "") : \Database_Result

Execute a query and return the result object

Parameters

$strQuery

Throws

\Exception

Returns

\Database_Result

escapeString()

escapeString(  $strString) 

Parameters

$strString

error()

error(  $strErrorMessage,   $strQuery,   $strErrorCode = '') 

Parameters

$strErrorMessage
$strQuery
$strErrorCode

replaceWildcards()

replaceWildcards(  $arrParams) 

Build the query string

Parameters

$arrParams

Throws

\Exception

escapeParams()

escapeParams(  $arrParams,   $blnIgnoreKeys = false) : array

Escape the parameters and serialize objects and arrays

Parameters

$arrParams
$blnIgnoreKeys

Returns

array

prepare_query()

prepare_query(  $strQuery) 

Prepare a query and return it

Parameters

$strQuery

string_escape()

string_escape(  $strString) : string

Escape a string

Parameters

$strString

Returns

string

limit_query()

limit_query(  $intRows,   $intOffset) 

Limit the current query

Parameters

$intRows
$intOffset

execute_query()

execute_query() : resource

Execute the current query

Returns

resource

get_error()

get_error() : string

Return the last error message

Returns

string

get_errno()

get_errno() : string

Return the last error code

Returns

string

affected_rows()

affected_rows() : integer

Return the number of affected rows

Returns

integer

insert_id()

insert_id() : integer

Return the last insert ID

Returns

integer

createResult()

createResult(  $resResult,   $strQuery) : \DB_Mysqli_Result

Create a Database_Result object

Parameters

$resResult
$strQuery

Returns

\DB_Mysqli_Result

explain_query()

explain_query() : array

Explain the current query

Returns

array

add_ticks()

add_ticks(  $mixTables) 

Parameters

$mixTables