Class vB_Database_MySQLi

Description

Class to interface with a MySQL 4.1 database

This class also handles data replication between a master and slave(s) servers

  • version: $Revision: 35065 $
  • date: $Date: 2010-01-21 14:01:23 -0600 (Thu, 21 Jan 2010) $

Located in /includes/class_core.php (line 1190)

vB_Database
   |
   --vB_Database_MySQLi
Direct descendents
Class Description
 class vB_Database_MySQLi_Explain Class to interface with a MySQL 4.1 database
 class vB_Database_Slave_MySQLi Class to handle interacting with a slave (and master) DB. Slave DBs are used for some reads. Master DBs are used for all writes and time-sensitive reads. (MySQLi)
Variable Summary
 array $fetchtypes
 array $functions
Method Summary
 object Mysqli db_connect (string $servername, integer $port, string $username, string $password, string $usepconnect, [string $configfile = ''], [string $charset = ''])
 string escape_string (string $string)
 string &execute_query ([boolean $buffered = true], string &$link)
 string field_name (string $queryresult, integer $index)
 boolean select_db_wrapper ([string $database = ''], [integer $link = null])
Variables
array $fetchtypes = array(
DBARRAY_NUM => MYSQLI_NUM,
DBARRAY_ASSOC => MYSQLI_ASSOC,
DBARRAY_BOTH => MYSQLI_BOTH
)
(line 1226)

Array of constants for use in fetch_array


Redefinition of:
vB_Database::$fetchtypes
Array of constants for use in fetch_array
array $functions = array(
'connect' => 'mysqli_real_connect',
'pconnect' => 'mysqli_real_connect', // mysqli doesn't support persistent connections THANK YOU!
'select_db' => 'mysqli_select_db',
'query' => 'mysqli_query',
'query_unbuffered' => 'mysqli_unbuffered_query',
'fetch_row' => 'mysqli_fetch_row',
'fetch_array' => 'mysqli_fetch_array',
'fetch_field' => 'mysqli_fetch_field',
'free_result' => 'mysqli_free_result',
'data_seek' => 'mysqli_data_seek',
'error' => 'mysqli_error',
'errno' => 'mysqli_errno',
'affected_rows' => 'mysqli_affected_rows',
'num_rows' => 'mysqli_num_rows',
'num_fields' => 'mysqli_num_fields',
'field_name' => 'mysqli_field_tell',
'insert_id' => 'mysqli_insert_id',
'escape_string' => 'mysqli_real_escape_string',
'real_escape_string' => 'mysqli_real_escape_string',
'close' => 'mysqli_close',
'client_encoding' => 'mysqli_client_encoding',
)
(line 1197)

Array of function names, mapping a simple name to the RDBMS specific function name


Redefinition of:
vB_Database::$functions
Array of function names, mapping a simple name to the RDBMS specific function name

Inherited Variables

Inherited from vB_Database

vB_Database::$appname
vB_Database::$appshortname
vB_Database::$connection_master
vB_Database::$connection_recent
vB_Database::$connection_slave
vB_Database::$database
vB_Database::$errno
vB_Database::$error
vB_Database::$locked
vB_Database::$maxpacket
vB_Database::$multiserver
vB_Database::$querycount
vB_Database::$registry
vB_Database::$reporterror
vB_Database::$shutdownqueries
vB_Database::$sql
Methods
db_connect (line 1247)

Initialize database connection(s)

Connects to the specified master database server, and also to the slave server if it is specified

  • return: Resource
object Mysqli db_connect (string $servername, integer $port, string $username, string $password, string $usepconnect, [string $configfile = ''], [string $charset = ''])
  • string $servername: Name of the database server - should be either 'localhost' or an IP address
  • integer $port: Port of the database server - usually 3306
  • string $username: Username to connect to the database server
  • string $password: Password associated with the username for the database server
  • string $usepconnect: Persistent Connections - Not supported with MySQLi
  • string $configfile: Configuration file from config.php.ini (my.ini / my.cnf)
  • string $charset: Mysqli Connection Charset PHP 5.1.0+ or 5.0.5+ / MySQL 4.1.13+ or MySQL 5.1.10+ Only

Redefinition of:
vB_Database::db_connect()
Initialize database connection(s)

Redefined in descendants as:
escape_string (line 1335)

Escapes a string to make it safe to be inserted into an SQL query

string escape_string (string $string)
  • string $string: The string to be escaped

Redefinition of:
vB_Database::escape_string()
Escapes a string to make it safe to be inserted into an SQL query
execute_query (line 1294)

Executes an SQL query through the specified connection

string &execute_query ([boolean $buffered = true], string &$link)
  • boolean $buffered: Whether or not to run this query buffered (true) or unbuffered (false). Default is unbuffered.
  • string &$link: The connection ID to the database server

Redefinition of:
vB_Database::execute_query()
Executes an SQL query through the specified connection

Redefined in descendants as:
field_name (line 1348)

Returns the name of a field from within a query result set

string field_name (string $queryresult, integer $index)
  • string $queryresult: The query result ID we are dealing with
  • integer $index: The index position of the field

Redefinition of:
vB_Database::field_name()
Returns the name of a field from within a query result set
select_db_wrapper (line 1323)

Simple wrapper for select_db(), to allow argument order changes

boolean select_db_wrapper ([string $database = ''], [integer $link = null])
  • string $database: Database name
  • integer $link: Link identifier

Redefinition of:
vB_Database::select_db_wrapper()
Simple wrapper for select_db(), to allow argument order changes

Inherited Methods

Inherited From vB_Database

 vB_Database::vB_Database()
 vB_Database::affected_rows()
 vB_Database::client_encoding()
 vB_Database::close()
 vB_Database::connect()
 vB_Database::data_seek()
 vB_Database::db_connect()
 vB_Database::errno()
 vB_Database::error()
 vB_Database::escape_string()
 vB_Database::escape_string_like()
 vB_Database::execute_query()
 vB_Database::fetch_array()
 vB_Database::fetch_field()
 vB_Database::fetch_row()
 vB_Database::field_name()
 vB_Database::force_sql_mode()
 vB_Database::found_rows()
 vB_Database::free_result()
 vB_Database::halt()
 vB_Database::hide_errors()
 vB_Database::insert_id()
 vB_Database::insert_multiple()
 vB_Database::lock_tables()
 vB_Database::num_fields()
 vB_Database::num_rows()
 vB_Database::query()
 vB_Database::query_first()
 vB_Database::query_first_slave()
 vB_Database::query_insert()
 vB_Database::query_read()
 vB_Database::query_read_slave()
 vB_Database::query_replace()
 vB_Database::query_write()
 vB_Database::select_db()
 vB_Database::select_db_wrapper()
 vB_Database::show_errors()
 vB_Database::shutdown_query()
 vB_Database::sql_prepare()
 vB_Database::unlock_tables()

Documentation generated on Tue, 26 Jan 2010 15:15:05 -0600 by phpDocumentor 1.4.3