- Class name: DbCore
- This is an abstract class
- Source: classes/db/Db.php line 30
- $_servers
- $database
- $instance
- $is_cache_enabled
- $last_cached
- $last_query
- $link
- $password
- $result
- $server
- $user
- Affected_Rows
- Insert_ID
- __construct
- __destruct
- _escape
- _numRows
- _query
- autoExecute
- autoExecuteWithNullValues
- checkConnection
- checkEncoding
- connect
- delete
- disconnect
- displayError
- ds
- escape
- execute
- executeS
- getClass
- getInstance
- getMsgError
- getNumberError
- getRow
- getValue
- getVersion
- hasTableWithSamePrefix
- insert
- nextRow
- numRows
- ps
- q
- query
- s
- set_db
- update
const INSERT = 1
Constants used by insert() method
- Source: classes/db/Db.php line 35.
const INSERT_IGNORE = 2
- Source: classes/db/Db.php line 36.
const REPLACE = 3
- Source: classes/db/Db.php line 37.
protected array $_servers = array(array('server' => _DB_SERVER_, 'user' => _DB_USER_, 'password' => _DB_PASSWD_, 'database' => _DB_NAME_))
- Visibility: protected
- This property is static.
- Source: classes/db/Db.php line 82.
protected string $database
- Visibility: protected
- Source: classes/db/Db.php line 57.
protected array $instance = array()
- Visibility: protected
- This property is static.
- Source: classes/db/Db.php line 77.
protected boolean $is_cache_enabled
- Visibility: protected
- Source: classes/db/Db.php line 62.
protected string $last_cached
Last cached query
- Visibility: protected
- Source: classes/db/Db.php line 101.
protected string $last_query
Store last executed query
- Visibility: protected
- Source: classes/db/Db.php line 94.
protected mixed $link
- Visibility: protected
- Source: classes/db/Db.php line 67.
protected string $password
- Visibility: protected
- Source: classes/db/Db.php line 52.
protected mixed $result
- Visibility: protected
- Source: classes/db/Db.php line 72.
protected string $server
- Visibility: protected
- Source: classes/db/Db.php line 42.
protected string $user
- Visibility: protected
- Source: classes/db/Db.php line 47.
mixed DbCore::Affected_Rows()
Get number of affected rows in previous database operation
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 136
mixed DbCore::Insert_ID()
Get the ID generated from the previous INSERT operation
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 131
mixed DbCore::__construct(string $server, string $user, string $password, string $database, boolean $connect)
Instantiate database connection
- Visibility: public
- Source: classes/db/Db.php line 230
- $server string - Server address
- $user string - User login
- $password string - User password
- $database string - Database name
- $connect boolean - If false, don't connect in constructor (since 1.5.0)
mixed DbCore::__destruct()
Close connection to database
- Visibility: public
- Source: classes/db/Db.php line 248
string DbCore::_escape(string $str)
Protect string against SQL injections
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 158
- $str string
mixed DbCore::_numRows(mixed $result)
Get number of rows in a result
- Visibility: protected
- This method is abstract.
- Source: classes/db/Db.php line 126
- $result mixed
mixed DbCore::_query(string $sql)
Execute a query and get result resource
- Visibility: protected
- This method is abstract.
- Source: classes/db/Db.php line 119
- $sql string
mixed DbCore::autoExecute($table, $data, $type, $where, $limit, $use_cache, $use_null)
- Visibility: public
- Source: classes/db/Db.php line 257
- $table mixed
- $data mixed
- $type mixed
- $where mixed
- $limit mixed
- $use_cache mixed
- $use_null mixed
mixed|boolean DbCore::autoExecuteWithNullValues(string $table, string $values, string $type, string $where, integer $limit)
Filter SQL query within a blacklist
- Visibility: public
- Source: classes/db/Db.php line 289
- $table string - Table where insert/update data
- $values string - Data to insert/update
- $type string - INSERT or UPDATE
- $where string - WHERE clause, only for UPDATE (optional)
- $limit integer - LIMIT clause (optional)
integer DbCore::checkConnection(string $server, string $user, string $pwd, string $db, boolean $new_db_link, boolean $engine, $timeout)
Try a connection to te database
- Visibility: public
- This method is static.
- Source: classes/db/Db.php line 642
- $server string - Server address
- $user string - Login for database connection
- $pwd string - Password for database connection
- $db string - Database name
- $new_db_link boolean
- $engine boolean
- $timeout mixed
integer DbCore::checkEncoding(string $server, string $user, string $pwd)
Try a connection to te database
- Visibility: public
- This method is static.
- Source: classes/db/Db.php line 655
- $server string - Server address
- $user string - Login for database connection
- $pwd string - Password for database connection
mixed DbCore::connect()
Open a connection
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 106
boolean DbCore::delete(string $table, string $where, integer $limit, boolean $use_cache, boolean $add_prefix)
Execute a DELETE query
- Visibility: public
- Source: classes/db/Db.php line 422
- $table string - Name of the table to delete
- $where string - WHERE clause on query
- $limit integer - Number max of rows to delete
- $use_cache boolean - Use cache or not
- $add_prefix boolean - Add or not DB_PREFIX before table name
mixed DbCore::disconnect()
Close a connection
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 111
mixed DbCore::displayError(boolean $sql)
Display last SQL error
- Visibility: public
- Source: classes/db/Db.php line 592
- $sql boolean
mixed DbCore::ds($sql, $use_cache)
- Visibility: public
- This method is static.
- Source: classes/db/Db.php line 698
- $sql mixed
- $use_cache mixed
string DbCore::escape(string $string, boolean $html_ok)
Sanitize data which will be injected into SQL query
- Visibility: public
- Source: classes/db/Db.php line 617
- $string string - SQL data which will be injected into SQL query
- $html_ok boolean - Does data contain HTML code ? (optional)
boolean DbCore::execute(string $sql, boolean $use_cache)
Execute a query
- Visibility: public
- Source: classes/db/Db.php line 442
- $sql string
- $use_cache boolean
array DbCore::executeS(string $sql, boolean $array, boolean $use_cache)
ExecuteS return the result of $sql as array
- Visibility: public
- Source: classes/db/Db.php line 461
- $sql string - query to execute
- $array boolean - return an array instead of a mysql_result object (deprecated since 1.5.0, use query method instead)
- $use_cache boolean - if query has been already executed, use its result
string DbCore::getClass()
Get child layer class
- Visibility: public
- This method is static.
- Source: classes/db/Db.php line 211
\Db DbCore::getInstance(boolean $master)
Get Db object instance
- Visibility: public
- This method is static.
- Source: classes/db/Db.php line 179
- $master boolean - Decides whether the connection to be returned by the master server or the slave server
mixed DbCore::getMsgError()
Returns the text of the error message from previous database operation
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 163
mixed DbCore::getNumberError()
Returns the number of the error from previous database operation
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 168
array DbCore::getRow(mixed $sql, boolean $use_cache)
getRow return an associative array containing the first row of the query This function automatically add "limit 1" to the query
- Visibility: public
- Source: classes/db/Db.php line 507
- $sql mixed - the select query (without "LIMIT 1")
- $use_cache boolean - find it in cache first
mixed DbCore::getValue(mixed $sql, boolean $use_cache)
getValue return the first item of a select query.
- Visibility: public
- Source: classes/db/Db.php line 539
- $sql mixed
- $use_cache boolean
string DbCore::getVersion()
Get database version
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 150
boolean DbCore::hasTableWithSamePrefix(string $server, string $user, string $pwd, string $db, string $prefix)
Try a connection to the database and check if at least one table with same prefix exists
- Visibility: public
- This method is static.
- Source: classes/db/Db.php line 670
- $server string - Server address
- $user string - Login for database connection
- $pwd string - Password for database connection
- $db string - Database name
- $prefix string - Tables prefix
boolean DbCore::insert(string $table, array $data, boolean $null_values, boolean $use_cache, integer $type, boolean $add_prefix)
Execute an INSERT query
- Visibility: public
- Source: classes/db/Db.php line 322
- $table string - Table name without prefix
- $data array - Data to insert as associative array. If $data is a list of arrays, multiple insert will be done
- $null_values boolean - If we want to use NULL values instead of empty quotes
- $use_cache boolean
- $type integer - Must be Db::INSERT or Db::INSERT_IGNORE or Db::REPLACE
- $add_prefix boolean - Add or not DB_PREFIX before table name
mixed DbCore::nextRow(mixed $result)
Get next row for a query which doesn't return an array
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 143
- $result mixed
integer DbCore::numRows()
Get number of rows for last result
- Visibility: public
- Source: classes/db/Db.php line 554
mixed DbCore::ps($sql, $use_cache)
- Visibility: public
- This method is static.
- Source: classes/db/Db.php line 687
- $sql mixed
- $use_cache mixed
mixed DbCore::q(string $sql, boolean $use_cache)
Execute a query
- Visibility: protected
- Source: classes/db/Db.php line 575
- $sql string
- $use_cache boolean
mixed DbCore::query(string $sql)
Execute a query and get result ressource
- Visibility: public
- Source: classes/db/Db.php line 300
- $sql string
mixed DbCore::s($sql, $use_cache)
- Visibility: public
- This method is static.
- Source: classes/db/Db.php line 678
- $sql mixed
- $use_cache mixed
mixed DbCore::set_db($db_name)
- Visibility: public
- This method is abstract.
- Source: classes/db/Db.php line 171
- $db_name mixed
boolean DbCore::update(string $table, array $data, string $where, integer $limit, boolean $null_values, boolean $use_cache, boolean $add_prefix)
- Visibility: public
- Source: classes/db/Db.php line 385
- $table string - Table name without prefix
- $data array - Data to insert as associative array. If $data is a list of arrays, multiple insert will be done
- $where string - WHERE condition
- $limit integer
- $null_values boolean - If we want to use NULL values instead of empty quotes
- $use_cache boolean
- $add_prefix boolean - Add or not DB_PREFIX before table name