Abstract Class JDatabase

Description

Database connector class

Located in /database/database.php (line 25)

JObject
   |
   --JDatabase
Direct descendents
Class Description
 class JDatabaseMySQL MySQL database driver
 class JDatabaseMySQLi MySQLi database driver
Variable Summary
 Internal $_cursor
 boolean $_debug
 string $_errorMsg
 int $_limit
 array $_log
 string $_nameQuote
 string $_nullDate
 int $_offset
 array $_quoted
 Internal $_resource
 string $_sql
 int $_ticker
 boolean $_utf
Method Summary
 JDatabase __construct ([string $host = 'localhost'], string $user, string $pass, [string $db = ''], [string $table_prefix = ''])
 void addQuoted (mixed $quoted)
 void BeginTrans ()
 void CommitTrans ()
 void debug (int $level)
 void ErrorMsg ()
 void ErrorNo ()
 object Execute (string $query)
 void explain ()
 void GenID ([mixed $foo1 = null], [mixed $foo2 = null])
 void GetCol (string $query)
 string getCollation ()
 string getErrorMsg ()
 int getErrorNum ()
 string getEscaped (mixed $text)
 database &getInstance ([string $driver = 'MySQL'], [string $host = 'localhost'], string $user, string $pass, [string $db = ''], [string $table_prefix = ''])
 string getNullDate ()
 int getNumRows ([object Database $cur = null])
 mixed GetOne (string $query)
 string getPrefix ()
 string getQuery ()
 array GetRow (string $query)
 array getTableCreate (array $tables)
 array getTableFields (array $tables)
 array getTableList ()
 boolean getUtfSupport ()
 void getVersion ()
 boolean hasUTF ()
 mixed insertid ()
 void insertObject (string $table, object &$object, [string $keyName = NULL], [boolean $verbose = false])
 bool isQuoted (string $fieldName)
 array loadAssocList ([string $key = ''])
 void loadObject (object The &$object)
 array loadObjectList ([string $key = ''])
 The loadResult ()
 void loadResultArray (mixed $numinarray)
 The loadRow ()
 array loadRowList ([string $key = ''])
 string NameQuote (string $s)
 void PageExecute (mixed $sql, mixed $nrows, mixed $page, [mixed $inputarr = false], mixed $secs2cache)
 mixed query ()
 mixed query_batch ([mixed $abort_on_error = true], [mixed $p_transaction_safe = false])
 string Quote (mixed $text)
 void replacePrefix (string $sql, [string $prefix = '#__'])
 void RollbackTrans ()
 void SelectLimit (mixed $query, mixed $count, mixed $offset)
 void setQuery (string $sql, string $offset, string $limit, [string $prefix = '#__'])
 void setUTF ()
 string stderr ([boolean $showSQL = false])
 void updateObject (string $table, object &$object, string $keyName, [boolean $updateNulls = true])
Variables
Internal $_cursor = null (line 38)
  • var: variable to hold the last query cursor
boolean $_debug = 0 (line 40)
  • var: Debug option
string $_errorMsg = '' (line 32)
  • var: Internal variable to hold the database error message
int $_errorNum = 0 (line 30)
  • var: Internal variable to hold the database error number
bool $_hasQuoted = null (line 67)
  • var: Legacy compatibility
  • since: 1.1
int $_limit = 0 (line 42)
  • var: The limit for the query
array $_log = null (line 48)
  • var: A log of queries
string $_nameQuote = null (line 52)
  • var: Quote for named objects

Redefined in descendants as:
string $_nullDate = null (line 50)
  • var: The null/zero date string

Redefined in descendants as:
int $_offset = 0 (line 44)
  • var: The for offset for the limit
array $_quoted = null (line 62)
  • var: The fields that are to be quote
  • since: 1.1
Internal $_resource = '' (line 36)
  • var: variable to hold the connector resource
string $_sql = '' (line 28)
  • var: Internal variable to hold the query sql
string $_table_prefix = '' (line 34)
  • var: Internal variable to hold the prefix used on all database tables
int $_ticker = 0 (line 46)
  • var: A counter for the number of queries performed by the object instance
boolean $_utf = 0 (line 57)
  • var: UTF-8 support
  • since: 1.1
Methods
Constructor __construct (line 78)

Database object constructor

JDatabase __construct ([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

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.

Redefined in descendants as:
addQuoted (line 173)

Adds a field or array of field names to the list that are to be quoted

  • since: 1.1
void addQuoted (mixed $quoted)
  • mixed $quoted: Field name or array of names
BeginTrans (line 633)

ADODB compatability function

  • since: 1.1
void BeginTrans ()
CommitTrans (line 645)

ADODB compatability function

  • since: 1.1
void CommitTrans ()
debug (line 198)

Sets the debug level on or off

void debug (int $level)
  • int $level: 0 = off, 1 = on
ErrorMsg (line 651)

ADODB compatability function

  • since: 1.1
void ErrorMsg ()
ErrorNo (line 658)

ADODB compatability function

  • since: 1.1
void ErrorNo ()
Execute (line 574)

ADODB compatability function

  • since: 1.1
object Execute (string $query)
  • string $query: SQL
explain (line 385)

Diagnostic function

  • abstract:
void explain ()

Redefined in descendants as:
GenID (line 665)

ADODB compatability function

  • since: 1.1
void GenID ([mixed $foo1 = null], [mixed $foo2 = null])
getAffectedRows (line 368)
  • return: The number of affected rows in the previous operation
  • since: 1.0.5
  • abstract:
int getAffectedRows ()

Redefined in descendants as:
GetCol (line 564)

ADODB compatability function

  • since: 1.1
void GetCol (string $query)
  • string $query: SQL
getCollation (line 513)
  • return: Collation in use
  • abstract:
string getCollation ()

Redefined in descendants as:
getErrorMsg (line 220)
  • return: The error message for the most recent query
string getErrorMsg ()
getErrorNum (line 214)
  • return: The error number for the most recent query
int getErrorNum ()
getEscaped (line 228)

Get a database escaped string

  • abstract:
string getEscaped (mixed $text)

Redefined in descendants as:
getInstance (line 128)

Returns a reference to the global Database object, only creating it if it doesn't already exist.

  • return: A database object
  • since: 1.1
database &getInstance ([string $driver = 'MySQL'], [string $host = 'localhost'], string $user, string $pass, [string $db = ''], [string $table_prefix = ''])
  • string $driver: Database driver
  • 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
getNullDate (line 253)
  • return: Quoted null/zero date string
string getNullDate ()
getNumRows (line 394)
  • return: The number of rows returned from the most recent query.
  • abstract:
int getNumRows ([object Database $cur = null])
  • object Database $cur: resource

Redefined in descendants as:
GetOne (line 624)

ADODB compatability function

  • since: 1.1
mixed GetOne (string $query)
  • string $query: SQL
getPrefix (line 247)
  • return: The database prefix
string getPrefix ()
getPublicProperties (line 155)

Returns an array of public properties

array getPublicProperties ()
getQuery (line 351)
  • return: The current value of the internal SQL vairable
string getQuery ()
GetRow (line 613)

ADODB compatability function

  • since: 1.1
array GetRow (string $query)
  • string $query: SQL
getTableCreate (line 536)
  • return: A list the create SQL for the tables
  • abstract:
array getTableCreate (array $tables)
  • array $tables: A list of table names

Redefined in descendants as:
getTableFields (line 544)
  • return: An array of fields by table
  • abstract:
array getTableFields (array $tables)
  • array $tables: A list of table names

Redefined in descendants as:
getTableList (line 528)
  • return: A list of all the tables in the database
  • abstract:
array getTableList ()

Redefined in descendants as:
getUtfSupport (line 207)
  • return: True if the database version supports utf storage False if backward compatibility is being used
  • since: 1.1
boolean getUtfSupport ()
getVersion (line 520)
  • abstract:
void getVersion ()

Redefined in descendants as:
hasUTF (line 102)

Determines UTF support

  • since: 1.1
  • abstract:
boolean hasUTF ()

Redefined in descendants as:
insertid (line 506)
  • abstract:
mixed insertid ()

Redefined in descendants as:
insertObject (line 476)
  • abstract:
void insertObject (string $table, object &$object, [string $keyName = NULL], [boolean $verbose = false])
  • string $table: The table name
  • object &$object
  • string $keyName
  • boolean $verbose

Redefined in descendants as:
isQuoted (line 186)

Checks if field name needs to be quoted

bool isQuoted (string $fieldName)
  • string $fieldName: The field name
loadAssocList (line 422)

Load a assoc list of database rows

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

Redefined in descendants as:
loadObject (line 433)

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.

  • abstract:
void loadObject (object The &$object)
  • object The &$object: address of variable

Redefined in descendants as:
loadObjectList (line 447)

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.
  • abstract:
array loadObjectList ([string $key = ''])
  • string $key: The field name of a primary key

Redefined in descendants as:
loadResult (line 403)

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.
  • abstract:
The loadResult ()

Redefined in descendants as:
loadResultArray (line 412)

Load an array of single field results into an array

  • abstract:
void loadResultArray (mixed $numinarray)

Redefined in descendants as:
loadRow (line 454)
  • return: first row of the query.
  • abstract:
The loadRow ()

Redefined in descendants as:
loadRowList (line 466)

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.
  • abstract:
array loadRowList ([string $key = ''])
  • string $key: The field name of a primary key

Redefined in descendants as:
NameQuote (line 236)

Quote an identifier name (field, table, etc)

  • return: The quoted name
string NameQuote (string $s)
  • string $s: The name
PageExecute (line 602)

ADODB compatability function

  • since: 1.1
void PageExecute (mixed $sql, mixed $nrows, mixed $page, [mixed $inputarr = false], mixed $secs2cache)
query (line 359)

Execute the query

  • return: A database resource if successful, FALSE if not.
  • abstract:
mixed query ()

Redefined in descendants as:
query_batch (line 377)

Execute a batch query

  • return: A database resource if successful, FALSE if not.
  • abstract:
mixed query_batch ([mixed $abort_on_error = true], [mixed $p_transaction_safe = false])

Redefined in descendants as:
Quote (line 556)

Get a quoted database escaped string

string Quote (mixed $text)
replacePrefix (line 280)

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
RollbackTrans (line 639)

ADODB compatability function

  • since: 1.1
void RollbackTrans ()
SelectLimit (line 593)

ADODB compatability function

  • since: 1.1
void SelectLimit (mixed $query, mixed $count, mixed $offset)
setQuery (line 266)

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 $offset, string $limit, [string $prefix = '#__'])
  • string $sql: The SQL query
  • string $offset: The offset to start selection
  • string $limit: The number of results to return
  • string $prefix: The common table prefix
setUTF (line 112)

Custom settings for UTF support

  • since: 1.1
  • abstract:
void setUTF ()

Redefined in descendants as:
stderr (line 496)
  • 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 487)
  • abstract:
void updateObject (string $table, object &$object, string $keyName, [boolean $updateNulls = true])
  • string $table
  • object &$object
  • string $keyName
  • boolean $updateNulls

Redefined in descendants as:

Inherited Methods

Inherited From JObject

 JObject::__construct()
 JObject::JObject()
 JObject::get()
 JObject::set()
 JObject::toString()
 JObject::__destruct()

Documentation generated on Sat, 4 Feb 2006 14:23:12 +0100 by phpDocumentor 1.3.0RC4