PHPonTraxTest
[ class tree: PHPonTraxTest ] [ index: PHPonTraxTest ] [ all elements ]

Class: DB_common

Source Location: /test/mockDB/DB.php

Class Overview

PEAR
   |
   --DB_common

Mock DB_common for testing


Author(s):

Variables

Methods


Child classes:

DB_mysql
Mock DB_mysql class

Class Details

[line 650]
Mock DB_common for testing



Tags:

todo:  Implement mock DB_common class


[ Top ]


Class Variables

$database = array('person_names' =>
              //  Description
              array('info' =>
                    array(array('table' => 'person_names',
                                'name'  => 'id',
                                'type'  => 'int',
                                'len'   => '11',
                                'flags' => 'primary_key not_null'),array('table'=>'person_names','name'=>'prefix','type'=>'string','len'=>'20','flags'=>''),array('table'=>'person_names','name'=>'first_name','type'=>'string','len'=>'40','flags'=>''),array('table'=>'person_names','name'=>'mi','type'=>'string','len'=>'1','flags'=>''),array('table'=>'person_names','name'=>'last_name','type'=>'string','len'=>'40','flags'=>''),array('table'=>'person_names','name'=>'suffix','type'=>'string','len'=>'20','flags'=>''),),'data'=>array()),//  Data types table
'data_types'=>//  Description
array('info'=>array(array("table"=>"data_types","name"=>"id","type"=>"int","len"=>'11',"flags"=>"not_null primary_key auto_increment"),array("table"=>"data_types","name"=>"bit_type","type"=>"int","len"=>'1',"flags"=>""),array("table"=>"data_types","name"=>"tinyint_type","type"=>"int","len"=>'4',"flags"=>""),array("table"=>"data_types","name"=>"bool_type","type"=>"int","len"=>'1',"flags"=>""),array("table"=>"data_types","name"=>"boolean_type","type"=>"int","len"=>'1',"flags"=>""),array("table"=>"data_types","name"=>"smallint_type","type"=>"int","len"=>'6',"flags"=>""),array("table"=>"data_types","name"=>"mediumint_type","type"=>"int","len"=>'9',"flags"=>""),array("table"=>"data_types","name"=>"int_type","type"=>"int","len"=>'11',"flags"=>""),array("table"=>"data_types","name"=>"integer_type","type"=>"int","len"=>'11',"flags"=>""),array("table"=>"data_types","name"=>"bigint_type","type"=>"int","len"=>'20',"flags"=>""),array("table"=>"data_types","name"=>"float_type","type"=>"real","len"=>'12',"flags"=>""),array("table"=>"data_types","name"=>"double_type","type"=>"real","len"=>'22',"flags"=>""),array("table"=>"data_types","name"=>"double_precision_type","type"=>"real","len"=>'22',"flags"=>""),array("table"=>"data_types","name"=>"decimal_type","type"=>"real","len"=>'11',"flags"=>""),array("table"=>"data_types","name"=>"dec_type","type"=>"real","len"=>'11',"flags"=>""),array("table"=>"data_types","name"=>"numeric_type","type"=>"real","len"=>'11',"flags"=>""),array("table"=>"data_types","name"=>"fixed_type","type"=>"real","len"=>'11',"flags"=>""),array("table"=>"data_types","name"=>"date_type","type"=>"date","len"=>'10',"flags"=>"binary"),array("table"=>"data_types","name"=>"datetime_type","type"=>"datetime","len"=>'19',"flags"=>"binary"),array("table"=>"data_types","name"=>"timestamp_type","type"=>"timestamp","len"=>'19',"flags"=>"unsigned zerofill binary"),array("table"=>"data_types","name"=>"time_type","type"=>"time","len"=>'8',"flags"=>"binary"),array("table"=>"data_types","name"=>"year_type","type"=>"year","len"=>'4',"flags"=>"unsigned zerofill"),array("table"=>"data_types","name"=>"char_type","type"=>"string","len"=>'20',"flags"=>""),array("table"=>"data_types","name"=>"varchar_type","type"=>"string","len"=>'20',"flags"=>""),array("table"=>"data_types","name"=>"nchar_type","type"=>"string","len"=>'20',"flags"=>""),array("table"=>"data_types","name"=>"binary_type","type"=>"string","len"=>'20',"flags"=>"binary"),array("table"=>"data_types","name"=>"varbinary_type","type"=>"string","len"=>'20',"flags"=>"binary"),array("table"=>"data_types","name"=>"tinyblob_type","type"=>"blob","len"=>'255',"flags"=>"blob binary"),array("table"=>"data_types","name"=>"tinytext_type","type"=>"blob","len"=>'255',"flags"=>"blob"),array("table"=>"data_types","name"=>"blob_type","type"=>"blob","len"=>'65535',"flags"=>"blob binary"),array("table"=>"data_types","name"=>"text_type","type"=>"blob","len"=>'65535',"flags"=>"blob"),array("table"=>"data_types","name"=>"mediumblob_type","type"=>"blob","len"=>'16777215',"flags"=>"blob binary"),array("table"=>"data_types","name"=>"mediumtext_type","type"=>"blob","len"=>'16777215',"flags"=>"blob"),array("table"=>"data_types","name"=>"longblob_type","type"=>"blob","len"=>'-1',"flags"=>"blob binary"),array("table"=>"data_types","name"=>"longtext_type","type"=>"blob","len"=>'-1',"flags"=>"blob"),array("table"=>"data_types","name"=>"enum_type","type"=>"string","len"=>'3',"flags"=>"enum"),array("table"=>"data_types","name"=>"set_type","type"=>"string","len"=>'7',"flags"=>"set"),),'data'=>array()),)

[line 655]

Mock Database



Tags:

static:  
access:  protected

Type:   mixed


[ Top ]

$expected_list =  null

[line 911]

List of expected queries and returns



Tags:

access:  private

Type:   mixed


[ Top ]

$expected_list_cursor =  null

[line 916]

Cursor in list of expected queries and returns



Tags:

access:  private

Type:   mixed


[ Top ]

$expected_query =  null

[line 922]

Expected query



Tags:

access:  private

Type:   string


[ Top ]

$expected_result =  null

[line 928]

Result to be returned from expected query



Tags:

access:  private

Type:   string


[ Top ]

$options = array(
        'result_buffering' => 500,
        'persistent' => false,
        'ssl' => false,
        'debug' => 0,
        'seqname_format' => '%s_seq',
        'autofree' => false,
        'portability' => DB_PORTABILITY_NONE,
        'optimize' => 'performance',  // Deprecated.  Use 'portability'.
    )

[line 897]

Run-time configuration options



Tags:


Type:   array


[ Top ]



Class Methods


constructor DB_common [line 935]

void DB_common( )

This constructor calls $this->PEAR('DB_Error')



[ Top ]

method affectedRows [line 2008]

int affectedRows( )

Determines the number of rows affected by a data maniuplation query

  1. is returned for queries that don't manipulate data.




Tags:

return:  the number of rows. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::affectedRows


Overridden in child classes as:

DB_mysql::affectedRows()
Determines the number of rows affected by a data maniuplation query

[ Top ]

method autoCommit [line 1961]

int autoCommit( [bool $onoff = false])

Enables or disables automatic commits



Tags:

return:  DB_OK on success. A DB_Error object if the driver doesn't support auto-committing transactions.
access:  public
todo:  Implement mock DB_common::autoCommit


Overridden in child classes as:

DB_mysql::autoCommit()
Enables or disables automatic commits

Parameters:

bool   $onoff   true turns it on, false turns it off

[ Top ]

method autoExecute [line 1220]

mixed autoExecute( string $table, array $fields_values, [int $mode = DB_AUTOQUERY_INSERT], [string $where = false])

Automaticaly generates an insert or update query and call prepare() and execute() with it



Tags:

return:  a new DB_result object for successful SELECT queries or DB_OK for successul data manipulation queries. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::autoExecute
uses:  DB_common::autoPrepare(), - DB_common::execute()


Parameters:

string   $table   the table name
array   $fields_values   the associative array where $key is a field name and $value its value
int   $mode   a type of query to make: DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
string   $where   for update queries: the WHERE clause to append to the SQL statement. Don't include the "WHERE" keyword.

[ Top ]

method autoPrepare [line 1190]

resource autoPrepare( string $table, array $table_fields, [int $mode = DB_AUTOQUERY_INSERT], [string $where = false])

Automaticaly generates an insert or update query and pass it to prepare()



Tags:

return:  the query handle
access:  public
todo:  Implement mock DB_common::autoPrepare
uses:  DB_common::prepare(), - DB_common::buildManipSQL()


Parameters:

string   $table   the table name
array   $table_fields   the array of field names
int   $mode   a type of query to make: DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
string   $where   for update queries: the WHERE clause to append to the SQL statement. Don't include the "WHERE" keyword.

[ Top ]

method buildManipSQL [line 1249]

string buildManipSQL( string $table, array $table_fields, int $mode, [string $where = false])

Produces an SQL query string for autoPrepare()



Tags:

return:  the sql query for autoPrepare()
access:  public
todo:  Implement mock DB_common::buildManipSQL


Parameters:

string   $table   the table name
array   $table_fields   the array of field names
int   $mode   a type of query to make: DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE
string   $where   for update queries: the WHERE clause to append to the SQL statement. Don't include the "WHERE" keyword.

[ Top ]

method commit [line 1972]

int commit( )

Commits the current transaction



Tags:

return:  DB_OK on success. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::commit


Overridden in child classes as:

DB_mysql::commit()
Commits the current transaction

[ Top ]

method createSequence [line 2056]

int createSequence( string $seq_name)

Creates a new sequence



Tags:

return:  DB_OK on success. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::createSequence
see:  DB_common::dropSequence(), DB_common::getSequenceName(), DB_common::nextID()


Overridden in child classes as:

DB_mysql::createSequence()
Creates a new sequence

Parameters:

string   $seq_name   name of the new sequence

[ Top ]

method dropSequence [line 2070]

int dropSequence( string $seq_name)

Deletes a sequence



Tags:

return:  DB_OK on success. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::dropSequence
see:  DB_common::createSequence(), DB_common::getSequenceName(), DB_common::nextID()


Overridden in child classes as:

DB_mysql::dropSequence()
Deletes a sequence

Parameters:

string   $seq_name   name of the sequence to be deleted

[ Top ]

method errorCode [line 2153]

int errorCode( string|int $nativecode)

Maps native error codes to DB's portable ones

Uses the $errorcode_map property defined in each driver.




Tags:

return:  the portable DB error code. Return DB_ERROR if the current driver doesn't have a mapping for the $nativecode submitted.
access:  public
todo:  Implement mock DB_common::errorCode


Parameters:

string|int   $nativecode   the error code returned by the DBMS

[ Top ]

method errorMessage [line 2171]

string errorMessage( integer $dbcode)

Maps a DB error code to a textual message



Tags:

return:  the error message corresponding to the error code submitted. FALSE if the error code is unknown.
access:  public
todo:  Implement mock DB_common::errorMessage
see:  DB::errorMessage()


Parameters:

integer   $dbcode   the DB error code

[ Top ]

method errorNative [line 2136]

mixed errorNative( )

Gets the DBMS' native error code produced by the last query



Tags:

return:  the DBMS' error code. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::errorNative


Overridden in child classes as:

DB_mysql::errorNative()
Gets the DBMS' native error code produced by the last query

[ Top ]

method escapeSimple [line 1047]

string escapeSimple( string $str)

Escapes a string according to the current DBMS's standards



Tags:

return:  the escaped string
access:  public
todo:  Implement mock DB_common::escapeSimple
see:  DB_common::quoteSmart()


Overridden in child classes as:

DB_mysql::escapeSimple()
Escapes a string according to the current DBMS's standards

Parameters:

string   $str   the string to be escaped

[ Top ]

method execute [line 1307]

mixed &execute( resource $stmt, [mixed $data = array()])

Executes a DB statement prepared with prepare()



Tags:

return:  a new DB_result object for successful SELECT queries or DB_OK for successul data manipulation queries. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::execute
see:  DB_common::prepare()


Parameters:

resource   $stmt   a DB statement resource returned from prepare()
mixed   $data   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or 1 placeholder per array element.

[ Top ]

method executeEmulateQuery [line 1341]

mixed executeEmulateQuery( resource $stmt, [mixed $data = array()])

Emulates executing prepared statements if the DBMS not support them



Tags:

return:  a string containing the real query run when emulating prepare/execute. A DB_Error object on failure.
access:  protected
todo:  Implement mock DB_common::executeEmulateQuery
see:  DB_common::execute()


Parameters:

resource   $stmt   a DB statement resource returned from execute()
mixed   $data   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or 1 placeholder per array element.

[ Top ]

method executeMultiple [line 1387]

int executeMultiple( resource $stmt, array $data)

Performs several execute() calls on the same statement handle



Tags:

return:  DB_OK on success. A DB_Error object on failure.
todo:  Implement mock DB_common::executeMultiple
see:  DB_common::prepare(), DB_common::execute()


Parameters:

resource   $stmt   query handle from prepare()
array   $data   numeric array containing the data to insert into the query

[ Top ]

method expect_queries [line 1478]

void expect_queries( string $list)

Set list of expected queries and returns

This is a test routine that does not exist in the PEAR DB package.




Tags:

access:  public


Parameters:

string   $list   Expected queries and returns

[ Top ]

method expect_query [line 1467]

void expect_query( string $expected, string $result)

Set expected query and return

This is a test routine that does not exist in the PEAR DB package.




Tags:

access:  public


Parameters:

string   $expected   Expected query
string   $result   Result to be returned when expected query is received.

[ Top ]

method freePrepared [line 1411]

bool freePrepared( resource $stmt, [bool $free_resource = true])

Frees the internal resources associated with a prepared query



Tags:

return:  TRUE on success, FALSE if $result is invalid
todo:  Implement mock DB_common::freePrepared
see:  DB_common::prepare()


Parameters:

resource   $stmt   the prepared statement's PHP resource
bool   $free_resource   should the PHP resource be freed too? Use false if you need to get data from the result set later.

[ Top ]

method getAll [line 1896]

array &getAll( string $query, [mixed $params = array()], [int $fetchmode = DB_FETCHMODE_DEFAULT])

Fetches all of the rows from a query result



Tags:

return:  the nested array. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::getAll


Parameters:

string   $query   the SQL query
mixed   $params   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or
  1. placeholder per array element.
int   $fetchmode   the fetch mode to use:
  • DB_FETCHMODE_ORDERED
  • DB_FETCHMODE_ASSOC
  • DB_FETCHMODE_ORDERED | DB_FETCHMODE_FLIPPED
  • DB_FETCHMODE_ASSOC | DB_FETCHMODE_FLIPPED

[ Top ]

method getAssoc [line 1787]

array &getAssoc( string $query, [bool $force_array = false], [mixed $params = array()], [int $fetchmode = DB_FETCHMODE_DEFAULT], [bool $group = false])

Fetches an entire query result and returns it as an associative array using the first column as the key



Tags:

return:  the associative array containing the query results. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::getAssoc


Parameters:

string   $query   the SQL query
bool   $force_array   used only when the query returns exactly two columns. If true, the values of the returned array will be one-element arrays instead of scalars.
mixed   $params   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or
  1. placeholder per array element.
int   $fetchmode   the fetch mode to use
bool   $group   if true, the values of the returned array is wrapped in another array. If the same key value (in the first column) repeats itself, the values will be appended to this array instead of overwriting the existing values.

[ Top ]

method getCol [line 1716]

array &getCol( string $query, [mixed $col = 0], [mixed $params = array()])

Fetches a single column from a query result and returns it as an indexed array



Tags:

return:  the results as an array. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::getCol
see:  DB_common::query()


Parameters:

string   $query   the SQL query
mixed   $col   which column to return (integer [column number, starting at 0] or string [column name])
mixed   $params   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or 1 placeholder per array element.

[ Top ]

method getListOf [line 2219]

array getListOf( string $type)

Lists internal database information



Tags:

return:  an array listing the items sought. A DB DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::getListOf


Parameters:

string   $type   type of information being sought. Common items being sought are: tables, databases, users, views, functions Each DBMS's has its own capabilities.

[ Top ]

method getOne [line 1609]

mixed &getOne( string $query, [mixed $params = array()])

Fetches the first column of the first row from a query result



Tags:

return:  the returned value of the query. A DB_Error object on failure.
todo:  Implement mock DB_common::getOne


Parameters:

string   $query   the SQL query
mixed   $params   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or 1 placeholder per array element.

[ Top ]

method getOption [line 1120]

mixed getOption( string $option)

Returns the value of an option



Tags:

return:  the option's value
access:  public
todo:  Implement mock DB_common::getOption


Parameters:

string   $option   the option name you're curious about

[ Top ]

method getRow [line 1652]

array &getRow( string $query, [mixed $params = array()], [int $fetchmode = DB_FETCHMODE_DEFAULT])

Fetches the first row of data returned from a query result



Tags:

return:  the first row of results as an array. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::getRow


Parameters:

string   $query   the SQL query
mixed   $params   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or 1 placeholder per array element.
int   $fetchmode   the fetch mode to use

[ Top ]

method getSequenceName [line 2022]

string getSequenceName( string $sqn)

Generates the name used inside the database for a sequence



Tags:

return:  the sequence's name in the backend
access:  protected
todo:  Implement mock DB_common::getSequenceName
see:  DB_common::createSequence(), DB_common::dropSequence(), DB_common::nextID(), DB_common::setOption()


Parameters:

string   $sqn   the sequence's public name

[ Top ]

method getSpecialQuery [line 2245]

string getSpecialQuery( string $type)

Obtains the query string needed for listing a given type of objects



Tags:

return:  the SQL query string or null if the driver doesn't support the object type requested
access:  protected
todo:  Implement mock DB_common::getSpecialQuery
see:  DB_common::getListOf()


Overridden in child classes as:

DB_mysql::getSpecialQuery()
Obtains the query string needed for listing a given type of objects

Parameters:

string   $type   the kind of objects you want to retrieve

[ Top ]

method limitQuery [line 1581]

mixed &limitQuery( string $query, intr $from, int $count, [mixed $params = array()])

Generates and executes a LIMIT query



Tags:

return:  a new DB_result object for successful SELECT queries or DB_OK for successul data manipulation queries. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::limitQuery


Parameters:

string   $query   the query
intr   $from   the row to start to fetching (0 = the first row)
int   $count   the numbers of rows to fetch
mixed   $params   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or 1 placeholder per array element.

[ Top ]

method modifyLimitQuery [line 1454]

string modifyLimitQuery( string $query, int $from, int $count, [mixed $params = array()])

Adds LIMIT clauses to a query string according to current DBMS standards



Tags:

return:  the query string with LIMIT clauses added
access:  protected
todo:  Implement mock DB_common::modifyLimitQuery


Overridden in child classes as:

DB_mysql::modifyLimitQuery()
Adds LIMIT clauses to a query string according to current DBMS standards

Parameters:

string   $query   the query to modify
int   $from   the row to start to fetching (0 = the first row)
int   $count   the numbers of rows to fetch
mixed   $params   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or 1 placeholder per array element.

[ Top ]

method modifyQuery [line 1434]

string modifyQuery( string $query)

Changes a query string for various DBMS specific reasons



Tags:

return:  the modified query string
access:  protected
todo:  Implement mock DB_common::modifyQuery
see:  DB_mysql::modifyQuery(), DB_oci8::modifyQuery(), DB_sqlite::modifyQuery()


Overridden in child classes as:

DB_mysql::modifyQuery()
Changes a query string for various DBMS specific reasons

Parameters:

string   $query   the query string to modify

[ Top ]

method nextId [line 2042]

int nextId( string $seq_name, [boolean $ondemand = true])

Returns the next free id in a sequence



Tags:

return:  the next id number in the sequence. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::nextID
see:  DB_common::createSequence(), DB_common::dropSequence(), DB_common::getSequenceName()


Overridden in child classes as:

DB_mysql::nextId()
Returns the next free id in a sequence

Parameters:

string   $seq_name   name of the sequence
boolean   $ondemand   when true, the seqence is automatically created if it does not exist

[ Top ]

method numRows [line 1995]

int numRows( resource $result)

Determines the number of rows in a query result



Tags:

return:  the number of rows. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::numRows


Overridden in child classes as:

DB_mysql::numRows()
Gets the number of rows in a result set

Parameters:

resource   $result   the query result idenifier produced by PHP

[ Top ]

method prepare [line 1137]

mixed prepare( string $query)

Prepares a query for multiple execution with execute()



Tags:

return:  DB statement resource on success. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::prepare
see:  DB_common::execute()


Parameters:

string   $query   the query to be prepared

[ Top ]

method provides [line 1059]

bool provides( string $feature)

Tells whether the present driver supports a given feature



Tags:

return:  whether this driver supports $feature
access:  public
todo:  Implement mock DB_common::provides


Parameters:

string   $feature   the feature you're curious about

[ Top ]

method query [line 1514]

mixed &query( string $query, [mixed $params = array()])

Sends a query to the database server



Tags:

return:  a new DB_result object for successful SELECT queries or DB_OK for successul data manipulation queries. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::query
see:  DB_result, DB_common::prepare(), DB_common::execute()


Parameters:

string   $query   the SQL query or the statement to prepare
mixed   $params   array, string or numeric data to be used in execution of the statement. Quantity of items passed must match quantity of placeholders in query: meaning 1 placeholder for non-array parameters or 1 placeholder per array element.

[ Top ]

method quoteIdentifier [line 1015]

string quoteIdentifier( string $str)

Quotes a string so it can be safely used as a table or column name



Tags:

return:  the quoted identifier
access:  public


Overridden in child classes as:

DB_mysql::quoteIdentifier()
Quotes a string so it can be safely used as a table or column name

Parameters:

string   $str   the identifier name to be quoted

[ Top ]

method quoteSmart [line 1026]

void quoteSmart( mixed $in)

Formats input so it can be safely used in a query



Tags:

access:  public
todo:  Implement mock DB_common::quoteSmart
see:  DB_common::escapeSimple()


[ Top ]

method raiseError [line 2099]

object the &raiseError( [mixed $code = DB_ERROR], [int $mode = null], [mixed $options = null], [string $userinfo = null], [mixed $nativecode = null])

Communicates an error and invoke error callbacks, etc

Basically a wrapper for PEAR::raiseError without the message string.




Tags:

return:  PEAR_Error object
access:  public
todo:  Implement mock DB_common::raiseError
see:  PEAR_Error


Parameters:

mixed   $code   integer error code, or a PEAR error object (all other parameters are ignored if this parameter is an object
int   $mode   error mode, see PEAR_Error docs
mixed   $options   if error mode is PEAR_ERROR_TRIGGER, this is the error level (E_USER_NOTICE etc). If error mode is PEAR_ERROR_CALLBACK, this is the callback function, either as a function name, or as an array of an object and method name. For other error modes this parameter is ignored.
string   $userinfo   extra debug information. Defaults to the last query and native error code.
mixed   $nativecode   native error code, integer or string depending the backend

[ Top ]

method rollback [line 1983]

int rollback( )

Reverts the current transaction



Tags:

return:  DB_OK on success. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::rollback


Overridden in child classes as:

DB_mysql::rollback()
Reverts the current transaction

[ Top ]

method setFetchMode [line 1080]

void setFetchMode( integer $fetchmode, [string $object_class = 'stdClass'])

Sets the fetch mode that should be used by default for query results



Tags:

access:  public
todo:  Implement mock DB_common::setFetchMode
see:  DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC, DB_FETCHMODE_OBJECT


Parameters:

integer   $fetchmode   DB_FETCHMODE_ORDERED, DB_FETCHMODE_ASSOC or DB_FETCHMODE_OBJECT
string   $object_class   the class name of the object to be returned by the fetch methods when the DB_FETCHMODE_OBJECT mode is selected. If no class is specified by default a cast to object from the assoc array row will be done. There is also the posibility to use and extend the 'DB_row' class.

[ Top ]

method setOption [line 1103]

int setOption( string $option, mixed $value)

Sets run-time configuration options for PEAR DB



Tags:

return:  DB_OK on success. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::setOption
see:  DB_common::$options


Parameters:

string   $option   option name
mixed   $value   value for the option

[ Top ]

method tableInfo [line 2197]

array tableInfo( object|string $result, [int $mode = null])

Returns information about a table or a result set



Tags:

return:  an associative array with the information requested. A DB_Error object on failure.
access:  public
todo:  Implement mock DB_common::tableInfo
see:  DB_common::setOption()


Overridden in child classes as:

DB_mysql::tableInfo()
Returns information about a table or a result set

Parameters:

object|string   $result   DB_result object from a query or a string containing the name of a table. While this also accepts a query result resource identifier, this behavior is deprecated.
int   $mode   either unused or one of the tableInfo modes: DB_TABLEINFO_ORDERTABLE, DB_TABLEINFO_ORDER or DB_TABLEINFO_FULL (which does both). These are bitwise, so the first two can be combined using |.

[ Top ]

method tally_queries [line 1490]

void tally_queries( )

Verify that all expected queries have been received

This is a test routine that does not exist in the PEAR DB package.




Tags:

access:  public


[ Top ]

method _convertNullArrayValuesToEmpty [line 2271]

void _convertNullArrayValuesToEmpty( array &$array)

Converts all null values in an array to empty strings



Tags:

access:  protected


Parameters:

array   $array   the array to be de-nullified (passed by reference)

[ Top ]

method _rtrimArrayValues [line 2256]

void _rtrimArrayValues( array &$array)

Right-trims all strings in an array



Tags:

access:  protected


Parameters:

array   $array   the array to be trimmed (passed by reference)

[ Top ]

method __sleep [line 947]

array __sleep( )

Automatically indicates which properties should be saved when PHP's serialize() function is called



Tags:

return:  the array of properties names that should be saved
todo:  Implement mock DB_common::__sleep


[ Top ]

method __toString [line 997]

string __toString( )

Automatic string conversion for PHP 5



Tags:

return:  a string describing the current PEAR DB object
access:  public
todo:  Implement mock DB_common::__toString


[ Top ]

method __wakeup [line 984]

void __wakeup( )

Automatically reconnects to the database when PHP's unserialize() function is called



Tags:

todo:  Implement mock DB_common::__wakeup


[ Top ]


Documentation generated on Thu, 04 May 2006 19:47:30 -0600 by phpDocumentor 1.3.0RC4