Class database

Description

Database connector class

Located in /includes/database.php (line 19)


	
			
Variable Summary
Internal $_cursor
boolean $_debug
string $_errorMsg
array $_log
Internal $_resource
string $_sql
int $_ticker
Method Summary
database database ([string $host = 'localhost'], string $user, string $pass, string $db, string $table_prefix)
void debug (int $level)
void explain ()
void GenID ([mixed $foo1 = null], [mixed $foo2 = null])
string getErrorMsg ()
int getErrorNum ()
string getEscaped (mixed $text)
int getNumRows ([mixed $cur = null])
string getQuery ()
array getTableCreate (array $tables)
array getTableFields (array $tables)
array getTableList ()
void getVersion ()
void insertid ()
void insertObject (mixed $table, mixed &$object, [[type] $keyName = NULL], [[type] $verbose = false])
array loadAssocList ([string $key = ''])
void loadObject (string &$object, object The 1)
array loadObjectList ([string $key = ''])
The loadResult ()
void loadResultArray (mixed $numinarray)
The loadRow ()
array loadRowList ([string $key = ''])
mixed query ()
void query_batch ([mixed $abort_on_error = true], [mixed $p_transaction_safe = false])
string Quote (mixed $text)
void setQuery (string $sql, [string $prefix = '#__'])
string stderr ([boolean $showSQL = false])
void updateObject (mixed $table, mixed &$object, mixed $keyName, [[type] $updateNulls = true])
Variables
Internal $_cursor = null (line 31)
  • var: variable to hold the last query cursor
boolean $_debug (line 33)
  • var: Debug option
string $_errorMsg = '' (line 25)
  • var: Internal variable to hold the database error message
int $_errorNum (line 23)
  • var: Internal variable to hold the database error number
array $_log = null (line 37)
  • var: A log of queries
Internal $_resource = '' (line 29)
  • var: variable to hold the connector resource
string $_sql = '' (line 21)
  • var: Internal variable to hold the query sql
string $_table_prefix = '' (line 27)
  • var: Internal variable to hold the prefix used on all database tables
int $_ticker (line 35)
  • var: A counter for the number of queries performed by the object instance
Methods
Constructor database (line 47)

Database object constructor

database database ([string $host = 'localhost'], string $user, string $pass, string $db, string $table_prefix)
  • string $host: Database host
  • string $user: Database user name
  • string $pass: Database user password
  • string $db: Database name
  • string $table_prefix: Common prefix for all tables
debug (line 80)
void debug (int $level)
  • int $level
explain (line 233)

Diagnostic function

void explain ()
GenID (line 505)

Fudge method for ADOdb compatibility

void GenID ([mixed $foo1 = null], [mixed $foo2 = null])
getErrorMsg (line 92)
  • return: The error message for the most recent query
string getErrorMsg ()
getErrorNum (line 86)
  • return: The error number for the most recent query
int getErrorNum ()
getEscaped (line 99)

Get a database escaped string

string getEscaped (mixed $text)
getNumRows (line 270)
  • return: The number of rows returned from the most recent query.
int getNumRows ([mixed $cur = null])
getQuery (line 162)
  • return: The current value of the internal SQL vairable
string getQuery ()
getTableCreate (line 520)
  • return: A list the create SQL for the tables
array getTableCreate (array $tables)
  • array $tables: A list of table names
getTableFields (line 535)
  • return: An array of fields by table
array getTableFields (array $tables)
  • array $tables: A list of table names
getTableList (line 511)
  • return: A list of all the tables in the database
array getTableList ()
getVersion (line 497)
void getVersion ()
insertid (line 492)
void insertid ()
insertObject (line 424)

Document::db_insertObject()

{ Description }

void insertObject (mixed $table, mixed &$object, [[type] $keyName = NULL], [[type] $verbose = false])
  • [type] $keyName
  • [type] $verbose
loadAssocList (line 309)

Load a assoc list of database rows

  • return: If key is empty as sequential list of returned records.
array loadAssocList ([string $key = ''])
  • string $key: The field name of a primary key
loadObject (line 332)

This global function loads the first row of a query into an object

If an object is passed to this function, the returned row is bound to the existing elements of object. If object has a value of null, then all of the returned query fields returned in the object.

void loadObject (string &$object, object The 1)
  • object The 1: address of variable
  • string &$object: The SQL query
loadObjectList (line 365)

Load a list of database objects

  • return: If key is empty as sequential list of returned records. If key is not empty then the returned array is indexed by the value the database key. Returns null if the query fails.
array loadObjectList ([string $key = ''])
  • string $key: The field name of a primary key
loadResult (line 279)

This method loads the first field of the first row returned by the query.

  • return: value returned in the query or null if the query failed.
The loadResult ()
loadResultArray (line 293)

Load an array of single field results into an array

void loadResultArray (mixed $numinarray)
loadRow (line 383)
  • return: first row of the query.
The loadRow ()
loadRowList (line 401)

Load a list of database rows (numeric column indexing)

  • return: If key is empty as sequential list of returned records. If key is not empty then the returned array is indexed by the value the database key. Returns null if the query fails.
array loadRowList ([string $key = ''])
  • string $key: The field name of a primary key
query (line 169)

Execute the query

  • return: A database resource if successful, FALSE if not.
mixed query ()
query_batch (line 197)
void query_batch ([mixed $abort_on_error = true], [mixed $p_transaction_safe = false])
Quote (line 106)

Get a quoted database escaped string

string Quote (mixed $text)
setQuery (line 118)

Sets the SQL query string for later execution.

This function replaces a string identifier $prefix with the string held is the _table_prefix class variable.

void setQuery (string $sql, [string $prefix = '#__'])
  • string $sql: The SQL query
  • string $prefix: The common table prefix
stderr (line 486)
  • return: A standised error message
string stderr ([boolean $showSQL = false])
  • boolean $showSQL: If TRUE, displays the last SQL statement sent to the database
updateObject (line 457)

Document::db_updateObject()

{ Description }

void updateObject (mixed $table, mixed &$object, mixed $keyName, [[type] $updateNulls = true])
  • [type] $updateNulls

Documentation generated on Fri, 4 Mar 2005 13:55:56 +1000 by phpDocumentor 1.3.0RC3