Class DbMySQLiCore
- Class name: DbMySQLiCore
- Parent class: Db
- Source: classes/db/DbMySQLi.php line 32
- $link
- $result
- $_servers
- $_slave_servers_loaded
- $database
- $instance
- $is_cache_enabled
- $last_cached
- $last_query
- $last_query_hash
- $password
- $server
- $user
- Affected_Rows
- Insert_ID
- __construct
- __destruct
- _escape
- _numRows
- _query
- autoExecute
- autoExecuteWithNullValues
- checkAutoIncrement
- checkConnection
- checkCreatePrivilege
- checkEncoding
- connect
- createDatabase
- delete
- deleteTestingInstance
- disableCache
- disconnect
- displayError
- ds
- enableCache
- escape
- execute
- executeS
- getAll
- getBestEngine
- getClass
- getInstance
- getLink
- getMsgError
- getNumberError
- getRow
- getValue
- getVersion
- hasTableWithSamePrefix
- insert
- loadSlaveServers
- nextRow
- numRows
- ps
- q
- query
- s
- setInstanceForTesting
- set_db
- tryToConnect
- tryUTF8
- update
protected \mysqli $link
- Visibility: protected
- Source: classes/db/DbMySQLi.php line 35.
protected mixed $result
- Visibility: protected
- Source: classes/db/DbMySQLi.php line 38.
public array $_servers = array()
- Visibility: public
- This property is static.
- This property is defined by DbCore.
- Source: classes/db/Db.php line 73.
public null $_slave_servers_loaded = null
- Visibility: public
- This property is static.
- This property is defined by DbCore.
- Source: classes/db/Db.php line 78.
protected string $database
- Visibility: protected
- This property is defined by DbCore.
- Source: classes/db/Db.php line 58.
public array $instance = array()
- Visibility: public
- This property is static.
- This property is defined by DbCore.
- Source: classes/db/Db.php line 70.
protected boolean $is_cache_enabled
- Visibility: protected
- This property is defined by DbCore.
- Source: classes/db/Db.php line 61.
protected string $last_cached
Last cached query
- Visibility: protected
- This property is defined by DbCore.
- Source: classes/db/Db.php line 99.
protected string $last_query
Store last executed query
- Visibility: protected
- This property is defined by DbCore.
- Source: classes/db/Db.php line 85.
protected string $last_query_hash
Store hash of the last executed query
- Visibility: protected
- This property is defined by DbCore.
- Source: classes/db/Db.php line 92.
protected string $password
- Visibility: protected
- This property is defined by DbCore.
- Source: classes/db/Db.php line 55.
protected string $server
- Visibility: protected
- This property is defined by DbCore.
- Source: classes/db/Db.php line 49.
protected string $user
- Visibility: protected
- This property is defined by DbCore.
- Source: classes/db/Db.php line 52.
integer DbMySQLiCore::Affected_Rows()
Return the number of rows affected by the last SQL query.
- Visibility: public
- Source: classes/db/DbMySQLi.php line 208
string|integer DbMySQLiCore::Insert_ID()
Returns ID of the last inserted row.
- Visibility: public
- Source: classes/db/DbMySQLi.php line 197
mixed DbCore::__construct(string $server, string $user, string $password, string $database, boolean $connect)
Instantiates a database connection
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 306
- $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.1)
mixed DbCore::__destruct()
Closes connection to database
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 345
string DbMySQLiCore::_escape(string $str)
Escapes illegal characters in a string.
- Visibility: public
- Source: classes/db/DbMySQLi.php line 254
- $str string
integer DbMySQLiCore::_numRows(boolean|\mysqli_result $result)
Returns row count from the result set.
- Visibility: protected
- Source: classes/db/DbMySQLi.php line 186
- $result boolean|mysqli_result
boolean|\mysqli_result DbMySQLiCore::_query(string $sql)
Executes an SQL statement, returning a result set as a mysqli_result object or true/false.
- Visibility: protected
- Source: classes/db/DbMySQLi.php line 124
- $sql string
boolean DbCore::autoExecute(string $table, array $data, string $type, string $where, integer $limit, boolean $use_cache, boolean $use_null)
Executes SQL query based on selected type
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 366
- $table string
- $data array
- $type string - (INSERT, INSERT IGNORE, REPLACE, UPDATE).
- $where string
- $limit integer
- $use_cache boolean
- $use_null boolean
boolean DbCore::autoExecuteWithNullValues(string $table, array $values, string $type, string $where, integer $limit)
Filter SQL query within a blacklist
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 398
- $table string - Table where insert/update data
- $values array - Data to insert/update
- $type string - INSERT or UPDATE
- $where string - WHERE clause, only for UPDATE (optional)
- $limit integer - LIMIT clause (optional)
boolean DbMySQLiCore::checkAutoIncrement(string $server, string $user, string $pwd)
Checks if auto increment value and offset is 1
- Visibility: public
- This method is static.
- Source: classes/db/DbMySQLi.php line 421
- $server string
- $user string
- $pwd string
integer DbCore::checkConnection(string $server, string $user, string $pwd, string $db, boolean $new_db_link, string|boolean $engine, integer $timeout)
Try a connection to the database
- Visibility: public
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 838
- $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 string|boolean
- $timeout integer
boolean|string DbMySQLiCore::checkCreatePrivilege(string $server, string $user, string $pwd, string $db, string $prefix, string|null $engine)
Tries to connect to the database and create a table (checking creation privileges)
- Visibility: public
- This method is static.
- Source: classes/db/DbMySQLi.php line 372
- $server string
- $user string
- $pwd string
- $db string
- $prefix string
- $engine string|null - Table engine
boolean DbCore::checkEncoding(string $server, string $user, string $pwd)
Try a connection to the database and set names to UTF-8
- Visibility: public
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 851
- $server string - Server address
- $user string - Login for database connection
- $pwd string - Password for database connection
\mysqli DbMySQLiCore::connect()
Tries to connect to the database
- Visibility: public
- Source: classes/db/DbMySQLi.php line 47
boolean|\mysqli_result DbMySQLiCore::createDatabase(string $host, string|null $user, string|null $password, string|null $database, boolean $dropit)
Tries to connect and create a new database
- Visibility: public
- This method is static.
- Source: classes/db/DbMySQLi.php line 92
- $host string
- $user string|null
- $password string|null
- $database string|null
- $dropit boolean - If true, drops the created database.
boolean DbCore::delete(string $table, string $where, integer $limit, boolean $use_cache, boolean $add_prefix)
Executes a DELETE query
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 572
- $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::deleteTestingInstance()
Unit testing purpose only
- Visibility: public
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 258
mixed DbCore::disableCache()
Disable the use of the cache
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 327
mixed DbMySQLiCore::disconnect()
Destroys the database connection link
- Visibility: public
- Source: classes/db/DbMySQLi.php line 112
mixed DbCore::displayError(string|boolean $sql)
Displays last SQL error
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 781
- $sql string|boolean
mixed DbCore::ds($sql, integer $use_cache)
Executes a query and kills process (dies)
- Visibility: public
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 937
- $sql mixed
- $use_cache integer
mixed DbCore::enableCache()
Enable & flush the cache
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 336
string DbCore::escape(string $string, boolean $html_ok, $bq_sql)
Sanitize data which will be injected into SQL query
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 805
- $string string - SQL data which will be injected into SQL query
- $html_ok boolean - Does data contain HTML code ? (optional)
- $bq_sql mixed
boolean DbCore::execute(string|\DbQuery $sql, boolean $use_cache)
Executes a query
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 595
- $sql string|string
- $use_cache boolean
array|false|null|\mysqli_result|\PDOStatement|resource DbCore::executeS(string|\DbQuery $sql, boolean $array, boolean $use_cache)
Executes return the result of $sql as array
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 618
- $sql string|string - Query to execute
- $array boolean - Return an array instead of a result object (deprecated since 1.5.0.1, use query method instead)
- $use_cache boolean
array|false DbMySQLiCore::getAll(boolean|\mysqli_result $result)
Returns all rows from the result set.
- Visibility: protected
- Source: classes/db/DbMySQLi.php line 156
- $result boolean|mysqli_result
string DbMySQLiCore::getBestEngine()
Selects best table engine.
- Visibility: public
- Source: classes/db/DbMySQLi.php line 332
string DbCore::getClass()
Returns the best child layer database class.
- Visibility: public
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 285
\Db DbCore::getInstance(boolean $master)
Returns database object instance.
- Visibility: public
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 210
- $master boolean - Decides whether the connection to be returned by the master server or the slave server
\PDO|\mysqli|resource DbCore::getLink()
Get used link instance
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 949
string DbMySQLiCore::getMsgError(boolean $query)
Returns error message.
- Visibility: public
- Source: classes/db/DbMySQLi.php line 220
- $query boolean
integer DbMySQLiCore::getNumberError()
Returns error code.
- Visibility: public
- Source: classes/db/DbMySQLi.php line 231
array|boolean|object|null DbCore::getRow(string|\DbQuery $sql, boolean $use_cache)
Returns an associative array containing the first row of the query This function automatically adds "LIMIT 1" to the query
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 672
- $sql string|string - the select query (without "LIMIT 1")
- $use_cache boolean - Find it in cache first
string|false|null DbCore::getValue(string|\DbQuery $sql, boolean $use_cache)
Returns a value from the first row, first column of a SELECT query
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 717
- $sql string|string
- $use_cache boolean
string DbMySQLiCore::getVersion()
Returns database server version.
- Visibility: public
- Source: classes/db/DbMySQLi.php line 242
boolean DbMySQLiCore::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/DbMySQLi.php line 282
- $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)
Executes an INSERT query
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 443
- $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::loadSlaveServers()
Loads configuration settings for slave servers if needed.
- Visibility: protected
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 266
array|boolean DbMySQLiCore::nextRow(boolean|\mysqli_result $result)
Returns the next row from the result set.
- Visibility: public
- Source: classes/db/DbMySQLi.php line 136
- $result boolean|mysqli_result
integer DbCore::numRows()
Get number of rows for last result
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 735
array|boolean|\mysqli_result|\PDOStatement|resource DbCore::ps($sql, integer $use_cache)
Executes a query
- Visibility: public
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 923
- $sql mixed
- $use_cache integer
boolean|\mysqli_result|\PDOStatement|resource DbCore::q(string|\DbQuery $sql, boolean $use_cache)
Executes a query
- Visibility: protected
- This method is defined by DbCore.
- Source: classes/db/Db.php line 756
- $sql string|string
- $use_cache boolean
boolean|\mysqli_result|\PDOStatement|resource DbCore::query(string|\DbQuery $sql)
Execute a query and get result resource
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 410
- $sql string|string
array|boolean|\mysqli_result|\PDOStatement|resource DbCore::s(string|\DbQuery $sql, boolean $use_cache)
Executes a query
- Visibility: public
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 909
- $sql string|string
- $use_cache boolean
mixed DbCore::setInstanceForTesting($test_db)
- Visibility: public
- This method is static.
- This method is defined by DbCore.
- Source: classes/db/Db.php line 250
- $test_db mixed - Db Unit testing purpose only
boolean DbMySQLiCore::set_db(string $db_name)
Switches to a different database.
- Visibility: public
- Source: classes/db/DbMySQLi.php line 266
- $db_name string
integer DbMySQLiCore::tryToConnect(string $server, string $user, string $pwd, string $db, $new_db_link, string|boolean $engine, integer $timeout)
Try a connection to the database
- Visibility: public
- This method is static.
- Source: classes/db/DbMySQLi.php line 307
- $server string - Server address
- $user string - Login for database connection
- $pwd string - Password for database connection
- $db string - Database name
- $new_db_link mixed
- $engine string|boolean
- $timeout integer
boolean DbMySQLiCore::tryUTF8(string $server, string $user, string $pwd)
Try a connection to the database and set names to UTF-8
- Visibility: public
- This method is static.
- Source: classes/db/DbMySQLi.php line 405
- $server string - Server address
- $user string - Login for database connection
- $pwd string - Password for database connection
boolean DbCore::update(string $table, array $data, string $where, integer $limit, boolean $null_values, boolean $use_cache, boolean $add_prefix)
Executes an UPDATE query
- Visibility: public
- This method is defined by DbCore.
- Source: classes/db/Db.php line 529
- $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