XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
DB Class Reference
Inheritance diagram for DB:
DBCubrid DBMssql DBMysql DBMysql_innodb DBMysqli DBMysqli_innodb

Public Member Functions

 getInstance ($db_type=NULL)
 
 create ()
 
 __construct ()
 
 getSupportedList ()
 
 _getSupportedList ()
 
 _sortDBMS ($a, $b)
 
 isSupported ()
 
 isConnected ($type= 'master', $indx=0)
 
 actStart ($query)
 
 actFinish ()
 
 setQueryLog ($log)
 
 setError ($errno=0, $errstr= 'success')
 
 isError ()
 
 getError ()
 
 executeQuery ($query_id, $args=NULL, $arg_columns=NULL, $type=NULL)
 
 checkQueryCacheFile ($query_id, $xml_file)
 
 _executeQuery ($cache_file, $source_args, $query_id, $arg_columns, $type)
 
 getCountCache ($tables, $condition)
 
 putCountCache ($tables, $condition, $count=0)
 
 resetCountCache ($tables)
 
 dropTable ($table_name)
 
 getSelectSql ($query, $with_values=TRUE)
 
 getClickCountQuery ($queryObject)
 
 getDeleteSql ($query, $with_values=TRUE, $with_priority=FALSE)
 
 getUpdateSql ($query, $with_values=TRUE, $with_priority=FALSE)
 
 getInsertSql ($query, $with_values=TRUE, $with_priority=FALSE)
 
 _getSlaveConnectionStringIndex ()
 
 _getConnection ($type= 'master', $indx=NULL)
 
 _dbInfoExists ()
 
 _close ($connection)
 
 close ($type= 'master', $indx=0)
 
 _begin ($transactionLevel=0)
 
 begin ()
 
 _rollback ($transactionLevel=0)
 
 rollback ()
 
 _commit ()
 
 commit ($force=FALSE)
 
 __query ($query, $connection)
 
 _query ($query, $connection=NULL)
 
 _setDBInfo ()
 
 __connect ($connection)
 
 _afterConnect ($connection)
 
 _connect ($type= 'master', $indx=0)
 
 actDBClassStart ()
 
 actDBClassFinish ()
 
 getParser ($force=FALSE)
 

Static Public Member Functions

static getEnableList ()
 
static getDisableList ()
 

Public Attributes

 $priority_dbms
 
 $count_cache_path = 'files/cache/db'
 
 $cond_operation
 
 $master_db = NULL
 
 $slave_db = NULL
 
 $result = NULL
 
 $errno = 0
 
 $errstr = ''
 
 $query = ''
 
 $connection = ''
 
 $elapsed_time = 0
 
 $elapsed_dbclass_time = 0
 
 $transaction_started = FALSE
 
 $is_connected = FALSE
 
 $cache_file = 'files/cache/queries/'
 
 $db_type
 
 $use_prepared_statements
 

Static Public Attributes

static $isSupported = FALSE
 
static $supported_list = array()
 

Detailed Description

Definition at line 16 of file DB.class.php.

Constructor & Destructor Documentation

DB::__construct ( )

constructor

Returns
void

Definition at line 188 of file DB.class.php.

Member Function Documentation

DB::__connect (   $connection)

DB Connect this method is protected

Parameters
array$connection
Returns
void

Definition at line 1243 of file DB.class.php.

DB::__query (   $query,
  $connection 
)

Execute the query this method is protected

Parameters
string$query
resource$connection
Returns
void

Definition at line 1181 of file DB.class.php.

DB::_afterConnect (   $connection)

If have a task after connection, add a taks in this method this method is protected

Parameters
resource$connection
Returns
void

Definition at line 1254 of file DB.class.php.

DB::_begin (   $transactionLevel = 0)

DB transaction start this method is protected

Returns
boolean

Definition at line 1088 of file DB.class.php.

DB::_close (   $connection)

DB disconnection this method is protected

Parameters
resource$connection
Returns
void

Definition at line 1050 of file DB.class.php.

DB::_commit ( )

DB transaction commit this method is protected

Returns
boolean

Definition at line 1147 of file DB.class.php.

DB::_connect (   $type = 'master',
  $indx = 0 
)

DB Connect this method is protected

Parameters
string$type'master' or 'slave'
int$indxnumber in slave dbms server list
Returns
void

Definition at line 1266 of file DB.class.php.

DB::_dbInfoExists ( )

check db information exists

Returns
boolean

Definition at line 1031 of file DB.class.php.

DB::_executeQuery (   $cache_file,
  $source_args,
  $query_id,
  $arg_columns,
  $type 
)

Execute query and return the result

Parameters
string$cache_filecache file of query
array | object$source_argsarguments for query
string$query_idquery id
array$arg_columnscolumn list. if you want get specific colums from executed result, add column list to $arg_columns
Returns
object result of query

Definition at line 605 of file DB.class.php.

DB::_getConnection (   $type = 'master',
  $indx = NULL 
)

Return connection resource

Parameters
string$typeuse 'master' or 'slave'. default value is 'master'
int$indxif indx value is NULL, return rand number in slave server list
Returns
resource

Definition at line 1001 of file DB.class.php.

DB::_getSlaveConnectionStringIndex ( )

Return index from slave server list

Returns
int

Definition at line 988 of file DB.class.php.

DB::_getSupportedList ( )

returns list of supported dbms list this method is private

Returns
array return supported DBMS list

Definition at line 265 of file DB.class.php.

DB::_query (   $query,
  $connection = NULL 
)

Execute the query this method is protected

Parameters
string$query
resource$connection
Returns
resource

Definition at line 1193 of file DB.class.php.

DB::_rollback (   $transactionLevel = 0)

DB transaction rollback this method is protected

Returns
boolean

Definition at line 1116 of file DB.class.php.

DB::_setDBInfo ( )

DB info settings this method is protected

Returns
void

Definition at line 1216 of file DB.class.php.

DB::_sortDBMS (   $a,
  $b 
)

sort dbms as priority

Definition at line 316 of file DB.class.php.

DB::actDBClassFinish ( )

Finish recording DBClass log

Returns
void

Definition at line 1323 of file DB.class.php.

DB::actDBClassStart ( )

Start recording DBClass log

Returns
void

Definition at line 1312 of file DB.class.php.

DB::actFinish ( )

finish recording log

Returns
void

Definition at line 389 of file DB.class.php.

DB::actStart (   $query)

start recording log

Parameters
string$queryquery string
Returns
void

Definition at line 377 of file DB.class.php.

DB::begin ( )

DB transaction start

Returns
void

Definition at line 1097 of file DB.class.php.

DB::checkQueryCacheFile (   $query_id,
  $xml_file 
)

Look for query cache file

Parameters
string$query_idquery id for finding
string$xml_fileoriginal xml query file
Returns
string cache file

Definition at line 576 of file DB.class.php.

DB::close (   $type = 'master',
  $indx = 0 
)

DB disconnection

Parameters
string$type'master' or 'slave'
int$indxnumber in slave dbms server list
Returns
void

Definition at line 1061 of file DB.class.php.

DB::commit (   $force = FALSE)

DB transaction commit

Parameters
boolean$forceregardless transaction start status or connect status, forced to commit
Returns
void

Definition at line 1157 of file DB.class.php.

DB::create ( )

returns instance of db

Returns
DB return DB object instance

Definition at line 179 of file DB.class.php.

DB::dropTable (   $table_name)

Drop tables

Parameters
string$table_name
Returns
void

Definition at line 800 of file DB.class.php.

DB::executeQuery (   $query_id,
  $args = NULL,
  $arg_columns = NULL,
  $type = NULL 
)

Execute Query that result of the query xml file This function finds xml file or cache file of $query_id, compiles it and then execute it

Parameters
string$query_idquery id (module.queryname)
array | object$argsarguments for query
array$arg_columnscolumn list. if you want get specific colums from executed result, add column list to $arg_columns
Returns
object result of query

Definition at line 509 of file DB.class.php.

DB::getClickCountQuery (   $queryObject)

Given a SELECT statement that uses click count returns the corresponding update sql string for databases that don't have click count support built in (aka all besides CUBRID)

Function does not check if click count columns exist! You must call $query->usesClickCount() before using this function

Parameters
$queryObject

Definition at line 885 of file DB.class.php.

DB::getCountCache (   $tables,
  $condition 
)

Returns counter cache data

Parameters
array | string$tablestables to get data
string$conditioncondition to get data
Returns
int count of cache data

Definition at line 672 of file DB.class.php.

DB::getDeleteSql (   $query,
  $with_values = TRUE,
  $with_priority = FALSE 
)

Return delete query string

Parameters
object$query
boolean$with_values
boolean$with_priority
Returns
string

Definition at line 911 of file DB.class.php.

static DB::getDisableList ( )
static

returns list of disable in supported dbms list this list return by child class

Returns
array return disable DBMS list in supported dbms list

Definition at line 238 of file DB.class.php.

static DB::getEnableList ( )
static

returns enable list in supported dbms list this list return by child class

Returns
array return enable DBMS list in supported dbms list

Definition at line 211 of file DB.class.php.

DB::getError ( )

Returns object of error info

Returns
object object of error

Definition at line 495 of file DB.class.php.

DB::getInsertSql (   $query,
  $with_values = TRUE,
  $with_priority = FALSE 
)

Return insert query string

Parameters
object$query
boolean$with_values
boolean$with_priority
Returns
string

Definition at line 975 of file DB.class.php.

DB::getInstance (   $db_type = NULL)

returns instance of certain db type

Parameters
string$db_typetype of db
Returns
DB return DB object instance

Definition at line 142 of file DB.class.php.

DB::getParser (   $force = FALSE)

Returns a database specific parser instance used for escaping expressions and table/column identifiers

Requires an implementation of the DB class (won't work if database is not set) this method is singleton

Parameters
boolean$forceforce load DBParser instance
Returns
DBParser

Definition at line 1345 of file DB.class.php.

DB::getSelectSql (   $query,
  $with_values = TRUE 
)

Return select query string

Parameters
object$query
boolean$with_values
Returns
string

Definition at line 816 of file DB.class.php.

DB::getSupportedList ( )

returns list of supported dbms list this list return by directory list check by instance can creatable

Returns
array return supported DBMS list

Definition at line 200 of file DB.class.php.

DB::getUpdateSql (   $query,
  $with_values = TRUE,
  $with_priority = FALSE 
)

Return update query string

Parameters
object$query
boolean$with_values
boolean$with_priority
Returns
string

Definition at line 943 of file DB.class.php.

DB::isConnected (   $type = 'master',
  $indx = 0 
)

Return connected status

Parameters
string$typemaster or slave
int$indxkey of server list
Returns
boolean true: connected, false: not connected

Definition at line 360 of file DB.class.php.

DB::isError ( )

Return error status

Returns
boolean true: error, false: no error

Definition at line 486 of file DB.class.php.

DB::isSupported ( )

Return dbms supportable status The value is set in the child class

Returns
boolean true: is supported, false: is not supported

Definition at line 349 of file DB.class.php.

DB::putCountCache (   $tables,
  $condition,
  $count = 0 
)

Save counter cache data

Parameters
array | string$tablestables to save data
string$conditioncondition to save data
int$countcount of cache data to save
Returns
void

Definition at line 732 of file DB.class.php.

DB::resetCountCache (   $tables)

Reset counter cache data

Parameters
array | string$tablestables to reset cache data
Returns
boolean true: success, false: failed

Definition at line 770 of file DB.class.php.

DB::rollback ( )

DB transaction rollback

Returns
void

Definition at line 1125 of file DB.class.php.

DB::setError (   $errno = 0,
  $errstr = 'success' 
)

set error

Parameters
int$errnoerror code
string$errstrerror message
Returns
void

Definition at line 476 of file DB.class.php.

DB::setQueryLog (   $log)

set query debug log

Parameters
array$logvalues set query debug
Returns
void

Definition at line 465 of file DB.class.php.

Member Data Documentation

DB::$cache_file = 'files/cache/queries/'

Definition at line 117 of file DB.class.php.

DB::$cond_operation
Initial value:
= array(
'equal' => '=',
'more' => '>=',
'excess' => '>',
'less' => '<=',
'below' => '<',
'notequal' => '<>',
'notnull' => 'is not null',
'null' => 'is null',
)

Definition at line 44 of file DB.class.php.

DB::$connection = ''

Definition at line 85 of file DB.class.php.

DB::$count_cache_path = 'files/cache/db'

Definition at line 38 of file DB.class.php.

DB::$db_type

Definition at line 123 of file DB.class.php.

DB::$elapsed_dbclass_time = 0

Definition at line 97 of file DB.class.php.

DB::$elapsed_time = 0

Definition at line 91 of file DB.class.php.

DB::$errno = 0

Definition at line 72 of file DB.class.php.

DB::$errstr = ''

Definition at line 78 of file DB.class.php.

DB::$is_connected = FALSE

Definition at line 104 of file DB.class.php.

DB::$isSupported = FALSE
static

Definition at line 19 of file DB.class.php.

DB::$master_db = NULL

Definition at line 59 of file DB.class.php.

DB::$priority_dbms
Initial value:
= array(
'mysqli' => 6,
'mysqli_innodb' => 5,
'mysql' => 4,
'mysql_innodb' => 3,
'cubrid' => 2,
'mssql' => 1
)

Definition at line 25 of file DB.class.php.

DB::$query = ''

Definition at line 84 of file DB.class.php.

DB::$result = NULL

Definition at line 66 of file DB.class.php.

DB::$slave_db = NULL

Definition at line 65 of file DB.class.php.

DB::$supported_list = array()
static

Definition at line 111 of file DB.class.php.

DB::$transaction_started = FALSE

Definition at line 103 of file DB.class.php.

DB::$use_prepared_statements

Definition at line 129 of file DB.class.php.


The documentation for this class was generated from the following file: