Class DBAPI_abstract

Description
Direct descendents
Class Description
Method Summary
DBAPI_abstract __construct ($parent $parent, [$host $host = ''], [$dbase $dbase = ''], [$uid $uid = ''], [$pwd $pwd = ''], [$pre $pre = null], [$charset $charset = ''], [$connection $connection_method = 'SET CHARACTER SET'])
void connect ([$host $host = ''], [$dbase $dbase = ''], [$uid $uid = ''], [$pwd $pwd = ''], [$persist $persist = false])
resource delete (string $from, [string $where = ''], [string|array $fields = ''])
void disconnect ()
string escape (string $s)
void freeResult ( $rs)
array getColumn (string $name, mixed $rsq)
array getColumnNames (mixed $rsq)
string getDBname ()
string getHostname ()
void getHTMLGrid (string|resource $rsq, array $params)
void getInsertId ()
string getLastError ([ $return_number = false], string $type)
int getRecordCount (resource $rs)
array getRow (resource $rs, [string $mode = 'assoc'])
array getTableMetaData (string $table)
string getValue (mixed $rsq)
string getVersion ()
string getXML (mixed $rsq)
void initDataTypes ()
mixed insert (string|array $fields, string $intotable, [string|array $fromfields = "*"], [string $fromtable = ''], [string $where = ''], [string $limit = ''])
mixed insert_ignore (string|array $fields, string $intotable, [string|array $fromfields = "*"], [string $fromtable = ''], [string $where = ''], [string $limit = ''])
bool is_handle (mixed $var)
mixed makeArray (resource $rs)
void make_connection ( $host,  $uid,  $pwd)
void make_persistent_connection ( $host,  $uid,  $pwd)
string prepareDate ( $timestamp, [ $fieldType = 'DATETIME'], int $timestamp:, string $fieldType:)
void p_connect ()
resource query (string $sql, [bool $suppress_errors = false])
mixed replace (string|array $fields, string $intotable, [string|array $fromfields = "*"], [string $fromtable = ''], [string $where = ''], [string $limit = ''])
resource select ([string|array $fields = "*"], [string $from = ''], [string $where = ''], [string $orderby = ''], [string $limit = ''])
void select_db ( $dbname)
void set_charset ( $charset)
bool; tables_present (string $prefix)
string table_engine ( $table)
void test_connect ([$host $host = ''], [$dbase $dbase = ''], [$uid $uid = ''], [$pwd $pwd = ''], [$query $query = ''])
resource update (string|array $fields, string $table, [string $where = ''])
void _escape ( $s)
array _getColumnNames (mixed $rs)
void _getInsertId ()
void _getRowAssoc ( $rs)
void _getRowBoth ( $rs)
void _getRowNumeric ( $rs)
void _query ( $sql)
void _recordcount ( $rs)
Methods
Constructor __construct (line 22)

The constructor. Can optionally have the database details passed to it, or alternatively it can use the globals (using the globals is deprecated functionality).

<<<< TODO throw E_USER_DEPRECATED after ensuring that Install and DocumentParser do not use the globals.

  • access: public
DBAPI_abstract __construct ($parent $parent, [$host $host = ''], [$dbase $dbase = ''], [$uid $uid = ''], [$pwd $pwd = ''], [$pre $pre = null], [$charset $charset = ''], [$connection $connection_method = 'SET CHARACTER SET'])
  • $parent $parent: Parent object e.g. $modx or $install
  • $host $host: db hostname
  • $dbase $dbase: db schema name
  • $uid $uid: db username
  • $pwd $pwd: db password
  • $pre $pre: table prefix
  • $charset $charset: client character set
  • $connection $connection_method: SQL to set connection character set
connect (line 58)

Connect to the database.

Can optionally have the database details passed to it but this is deprecated functionality. Pass the details in the constructor instead.

  • access: public
void connect ([$host $host = ''], [$dbase $dbase = ''], [$uid $uid = ''], [$pwd $pwd = ''], [$persist $persist = false])
  • $host $host: db hostname
  • $dbase $dbase: db schema name
  • $uid $uid: db username
  • $pwd $pwd: db password
  • $persist $persist: If true, make a persistent connection.
connection_check (line 139)

Check for connection

  • access: protected
void connection_check ()
delete (line 237)

DELETE

  • access: public
resource delete (string $from, [string $where = ''], [string|array $fields = ''])
  • string $from
  • string $where
  • string|array $fields
disconnect (line 182)

Disconnect from db.

RDBMS specific.

  • abstract:
  • access: public
void disconnect ()

Redefined in descendants as:
escape (line 194)

Escape a string

  • access: public
string escape (string $s)
  • string $s
freeResult (line 528)

Free memory associated with a resultset

  • abstract:
  • access: public
void freeResult ( $rs)
  • $rs

Redefined in descendants as:
getAffectedRows (line 385)

Get the number of affected rows.

RDBMS specific.

  • abstract:
  • access: public
int getAffectedRows ()

Redefined in descendants as:
getColumn (line 435)

Returns an array of the values found on column $name

  • access: public
array getColumn (string $name, mixed $rsq)
  • string $name: Column name
  • mixed $rsq: Resultset or query string
getColumnNames (line 456)

Returns an array containing the column names in a resultset.

  • access: public
array getColumnNames (mixed $rsq)
  • mixed $rsq: Resultset or query string
getDBname (line 663)

Get name of database.

  • access: public
string getDBname ()
getHostname (line 654)

Get name of host.

  • access: public
string getHostname ()
getHTMLGrid (line 586)
  • access: public
void getHTMLGrid (string|resource $rsq, array $params)
  • string|resource $rsq: Resultset or SQL query
  • array $params: Data grid parameters columnHeaderClass tableClass itemClass altItemClass columnHeaderStyle tableStyle itemStyle altItemStyle columns fields colWidths colAligns colColors colTypes cellPadding cellSpacing header footer pageSize pagerLocation pagerClass pagerStyle
getInsertId (line 374)

Get the last insert ID

  • access: public
void getInsertId ()
getLastError (line 395)

Get the last error.

RDBMS specific.

  • abstract:
  • access: public
string getLastError ([ $return_number = false], string $type)
  • string $type
  • $return_number

Redefined in descendants as:
getRecordCount (line 403)

Get the number of rows in a resultset. Return 0 if resultset invalid.

  • access: public
int getRecordCount (resource $rs)
  • resource $rs: Resultset
getRow (line 414)

Return an array of column values

  • access: public
array getRow (resource $rs, [string $mode = 'assoc'])
  • resource $rs: Resultset
  • string $mode: 'assoc', 'num' or 'both'.
getTableMetaData (line 513)

Returns an array of structure detail for each column of a

  • abstract:
  • access: public
array getTableMetaData (string $table)
  • string $table: The full name of the database table

Redefined in descendants as:
getValue (line 471)

Returns the value from the first column in the set.

  • access: public
string getValue (mixed $rsq)
  • mixed $rsq: Resultset or query string
getVersion (line 521)

Returns a string containing the database server version

  • abstract:
  • access: public
string getVersion ()

Redefined in descendants as:
getXML (line 489)

Returns an XML representation of the dataset $rsq

  • access: public
string getXML (mixed $rsq)
  • mixed $rsq: Resultset or query string
initDataTypes (line 40)

Called in the constructor to set up arrays containing the types of database fields that can be used with specific PHP types.

RDBMS specific.

  • abstract:
  • access: protected
void initDataTypes ()

Redefined in descendants as:
insert (line 306)

INSERT

  • return: Either last id inserted (if supported) or the result from the query
  • access: public
mixed insert (string|array $fields, string $intotable, [string|array $fromfields = "*"], [string $fromtable = ''], [string $where = ''], [string $limit = ''])
  • string|array $fields
  • string $intotable
  • string|array $fromfields
  • string $fromtable
  • string $where
  • string $limit
insert_ignore (line 321)

INSERT IGNORE

  • return: Either last id inserted (if supported) or the result from the query
  • access: public
mixed insert_ignore (string|array $fields, string $intotable, [string|array $fromfields = "*"], [string $fromtable = ''], [string $where = ''], [string $limit = ''])
  • string|array $fields
  • string $intotable
  • string|array $fromfields
  • string $fromtable
  • string $where
  • string $limit
is_handle (line 673)

Is a variable a resultset handle?

  • abstract:
bool is_handle (mixed $var)
  • mixed $var

Redefined in descendants as:
makeArray (line 637)

Turns a recordset into a multidimensional array

  • return: An array of row arrays from recordset, or empty array if the recordset was empty, returns false if no recordset was passed
  • access: public
mixed makeArray (resource $rs)
  • resource $rs: Resultset
make_connection (line 150)

Connect to the RDBMS.

RDBMS specific.

  • abstract:
  • access: protected
void make_connection ( $host,  $uid,  $pwd)
  • $host
  • $uid
  • $pwd

Redefined in descendants as:
make_persistent_connection (line 157)

Connect to the RDBMS persistently.

RDBMS specific.

  • abstract:
  • access: protected
void make_persistent_connection ( $host,  $uid,  $pwd)
  • $host
  • $uid
  • $pwd

Redefined in descendants as:
prepareDate (line 538)

Prepares a date in the proper format for specific database types given a UNIX timestamp

  • access: public
string prepareDate ( $timestamp, [ $fieldType = 'DATETIME'], int $timestamp:, string $fieldType:)
  • int $timestamp:: a UNIX timestamp
  • string $fieldType:: the type of field to format the date for (in MySQL, you have DATE, TIME, YEAR, and DATETIME)
  • $timestamp
  • $fieldType
p_connect (line 132)

Make a persistent connection to the database.

  • access: public
void p_connect ()
query (line 208)

Query the database.

Developers should use select, update, insert (etc), delete where possible

  • access: public
resource query (string $sql, [bool $suppress_errors = false])
  • string $sql
  • bool $suppress_errors: If true, return false on error, otherwise quit via MessageQuit().
replace (line 336)

REPLACE

  • return: Either last id inserted (if supported) or the result from the query
  • access: public
mixed replace (string|array $fields, string $intotable, [string|array $fromfields = "*"], [string $fromtable = ''], [string $where = ''], [string $limit = ''])
  • string|array $fields
  • string $intotable
  • string|array $fromfields
  • string $fromtable
  • string $where
  • string $limit
select (line 257)

SELECT

  • access: public
resource select ([string|array $fields = "*"], [string $from = ''], [string $where = ''], [string $orderby = ''], [string $limit = ''])
  • string|array $fields
  • string $from
  • string $where
  • string $orderby
  • string $limit
select_db (line 171)

Select a database.

RDBMS specific.

  • abstract:
  • access: protected
void select_db ( $dbname)
  • $dbname

Redefined in descendants as:
set_charset (line 164)

Set connection character set

RDBMS specific

  • abstract:
  • access: protected
void set_charset ( $charset)
  • $charset

Redefined in descendants as:
tables_present (line 681)

Test for presence of Clipper db tables

  • abstract:
bool; tables_present (string $prefix)
  • string $prefix

Redefined in descendants as:
table_engine (line 688)

Get table engine

  • abstract:
string table_engine ( $table)
  • $table

Redefined in descendants as:
test_connect (line 105)

Test database connection or selection

Intended for installer use only. Does not set character set of connection.

Will return false on failure and will not log errors or display any errors via DocumentParser::MessageQuit().

void test_connect ([$host $host = ''], [$dbase $dbase = ''], [$uid $uid = ''], [$pwd $pwd = ''], [$query $query = ''])
  • $host $host: db hostname
  • $dbase $dbase: Optional db schema name
  • $uid $uid: db username
  • $pwd $pwd: db password
  • $query $query: Optional query to run
update (line 277)

UPDATE

  • access: public
resource update (string|array $fields, string $table, [string $where = ''])
  • string|array $fields
  • string $table
  • string $where
_escape (line 699)

Escape a string,

RDBMS specific.

  • abstract:
  • access: protected
void _escape ( $s)
  • $s

Redefined in descendants as:
_getColumnNames (line 730)

Get the column names in a resultset

RDBMS specific.

  • abstract:
  • access: protected
array _getColumnNames (mixed $rs)
  • mixed $rs: resultset

Redefined in descendants as:
_getInsertId (line 713)

Get the last insert ID.

RDBMS specific.

  • abstract:
  • access: protected
void _getInsertId ()

Redefined in descendants as:
_getRowAssoc (line 737)

Get a row into an associative array.

RDBMS specific.

  • abstract:
  • access: protected
void _getRowAssoc ( $rs)
  • $rs

Redefined in descendants as:
_getRowBoth (line 751)

Get a row into both an associative and numeric array.

RDBMS specific.

  • abstract:
  • access: protected
void _getRowBoth ( $rs)
  • $rs

Redefined in descendants as:
_getRowNumeric (line 744)

Get a row into a numeric array.

RDBMS specific.

  • abstract:
  • access: protected
void _getRowNumeric ( $rs)
  • $rs

Redefined in descendants as:
_query (line 706)

Make a query.

RDBMS specific.

  • abstract:
  • access: protected
void _query ( $sql)
  • $sql

Redefined in descendants as:
_recordcount (line 720)

Get the number of records in the resultset.

RDBMS specific.

  • abstract:
  • access: protected
void _recordcount ( $rs)
  • $rs

Redefined in descendants as:

Documentation generated on Fri, 21 Jun 2013 12:37:00 +0100 by phpDocumentor 1.4.4