Class database

Description

Database connector class

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


	
			
Direct descendents
Class Description
 class mamboDatabase Database connector class
Variable Summary
 Internal $_cursor
 boolean $_debug
 string $_errorMsg
 array $_log
 string $_null_date
 Internal $_resource
 string $_sql
Method Summary
 database database ([string $host = 'localhost'], string $user, string $pass, string $db, string $table_prefix)
 void debug (int $level)
 void debug_trace ()
 void displayLogged ()
 void doSQL ( $sql)
 void &doSQLget ( $sql,  $classname)
 void explain ()
 void forceOffline ( $error_number)
 void GenID ([ $foo1 = null], [ $foo2 = null])
 string getErrorMsg ()
 int getErrorNum ()
 string getEscaped ( $text)
 void getNullDate ()
 int getNumRows ([ $cur = null])
 string getQuery ([ $sql = ''])
 array getTableCreate (array $tables)
 array getTableFields (array $tables)
 array getTableList ()
 void getVersion ()
 void insertid ()
 void insertObject ( $table,  &$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 ([ $numinarray = 0])
 The loadRow ()
 array loadRowList ([string $key = ''])
 void mosBindArrayToObject (array $array, obj &$obj, [string $ignore = ''], [boolean $prefix = NULL], [ $checkSlashes = true])
 void mosStripslashes (value &$value)
 mixed query ([ $sql = ''])
 void query_batch ([ $abort_on_error = true], [ $p_transaction_safe = false])
 string Quote ( $text)
 void replacePrefix (string $sql, [string $prefix = '#__'])
 array &retrieveResults ([int $key = ''], [string $max = 0], [ $result_type = 'row'])
 void setBareQuery (string $sql)
 void setQuery (string $sql, [string $prefix = '#__'])
 string stderr ([boolean $showSQL = false])
 void updateObject ( $table,  &$object,  $keyName, [[type] $updateNulls = true])
Variables
Internal $_cursor = null (line 25)
  • var: variable to hold the last query cursor
boolean $_debug (line 27)
  • var: Debug option
string $_errorMsg = '' (line 19)
  • var: Internal variable to hold the database error message
int $_errorNum (line 17)
  • var: Internal variable to hold the database error number
array $_log = array() (line 29)
  • var: A log of queries
string $_null_date = '0000-00-00 00:00:00' (line 31)
  • var: Null date
Internal $_resource = '' (line 23)
  • var: variable to hold the connector resource
string $_sql = '' (line 15)
  • var: Internal variable to hold the query sql
string $_table_prefix = '' (line 21)
  • var: Internal variable to hold the prefix used on all database tables
Methods
Constructor database (line 41)

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 102)
void debug (int $level)
  • int $level
debug_trace (line 106)
void debug_trace ()
displayLogged (line 570)
void displayLogged ()
doSQL (line 579)
void doSQL ( $sql)
  • $sql
doSQLget (line 588)
void &doSQLget ( $sql,  $classname)
  • $sql
  • $classname
explain (line 261)

Diagnostic function

void explain ()
forceOffline (line 88)
void forceOffline ( $error_number)
  • $error_number
GenID (line 525)

Fudge method for ADOdb compatibility

void GenID ([ $foo1 = null], [ $foo2 = null])
  • $foo1
  • $foo2
getAffectedRows (line 289)
  • return: The number of rows affected by the most recent query - INSERT, UPDATE, DELETE
int getAffectedRows ()
getErrorMsg (line 126)
  • return: The error message for the most recent query
string getErrorMsg ()
getErrorNum (line 120)
  • return: The error number for the most recent query
int getErrorNum ()
getEscaped (line 133)

Get a database escaped string

string getEscaped ( $text)
  • $text
getNullDate (line 96)
void getNullDate ()
getNumRows (line 282)
  • return: The number of rows returned from the most recent query - SELECT only
int getNumRows ([ $cur = null])
  • $cur
getQuery (line 203)
  • return: The current value of the internal SQL vairable
string getQuery ([ $sql = ''])
  • $sql
getTableCreate (line 540)
  • return: A list the create SQL for the tables
array getTableCreate (array $tables)
  • array $tables: A list of table names
getTableFields (line 555)
  • return: An array of fields by table
array getTableFields (array $tables)
  • array $tables: A list of table names
getTableList (line 531)
  • return: A list of all the tables in the database
array getTableList ()
getVersion (line 517)
void getVersion ()
insertid (line 512)
void insertid ()
insertObject (line 457)

Document::db_insertObject()

{ Description }

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

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 398)

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 423)

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 326)

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 335)

Load an array of single field results into an array

void loadResultArray ([ $numinarray = 0])
  • $numinarray
loadRow (line 431)
  • return: first row of the query.
The loadRow ()
loadRowList (line 443)

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
mosBindArrayToObject (line 360)

Copy the named array content into the object as properties

only existing properties of object are filled. when undefined in hash, properties wont be deleted

void mosBindArrayToObject (array $array, obj &$obj, [string $ignore = ''], [boolean $prefix = NULL], [ $checkSlashes = true])
  • array $array: the input array
  • obj &$obj: byref the object to fill of any class
  • string $ignore
  • boolean $prefix
  • $checkSlashes
mosStripslashes (line 377)

Strip slashes from strings or arrays of strings

void mosStripslashes (value &$value)
  • value &$value: the input string or array
query (line 211)

Execute the query

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

Get a quoted database escaped string

string Quote ( $text)
  • $text
replacePrefix (line 182)

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

  • author: thede, David McKinnis
void replacePrefix (string $sql, [string $prefix = '#__'])
  • string $sql: The SQL query
  • string $prefix: The common table prefix
retrieveResults (line 301)

Load an array of retrieved database objects or values

  • 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 &retrieveResults ([int $key = ''], [string $max = 0], [ $result_type = 'row'])
  • int $key: Database cursor
  • string $max: The field name of a primary key
  • $result_type
setBareQuery (line 156)

Sets the SQL query string for later execution.

void setBareQuery (string $sql)
  • string $sql: The SQL query
setQuery (line 168)

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 506)
  • 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 483)

Document::db_updateObject()

{ Description }

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

Documentation generated on Mon, 05 May 2008 16:19:10 +0400 by phpDocumentor 1.4.0