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

Class: DB_mysql

Source Location: /test/mockDB/DB.php

Class Overview

PEAR
   |
   --DB_common
      |
      --DB_mysql

Mock DB_mysql class


Methods


Inherited Variables

Inherited Methods

Class: DB_common

DB_common::DB_common()
This constructor calls $this->PEAR('DB_Error')
DB_common::affectedRows()
Determines the number of rows affected by a data maniuplation query
DB_common::autoCommit()
Enables or disables automatic commits
DB_common::autoExecute()
Automaticaly generates an insert or update query and call prepare() and execute() with it
DB_common::autoPrepare()
Automaticaly generates an insert or update query and pass it to prepare()
DB_common::buildManipSQL()
Produces an SQL query string for autoPrepare()
DB_common::commit()
Commits the current transaction
DB_common::createSequence()
Creates a new sequence
DB_common::dropSequence()
Deletes a sequence
DB_common::errorCode()
Maps native error codes to DB's portable ones
DB_common::errorMessage()
Maps a DB error code to a textual message
DB_common::errorNative()
Gets the DBMS' native error code produced by the last query
DB_common::escapeSimple()
Escapes a string according to the current DBMS's standards
DB_common::execute()
Executes a DB statement prepared with prepare()
DB_common::executeEmulateQuery()
Emulates executing prepared statements if the DBMS not support them
DB_common::executeMultiple()
Performs several execute() calls on the same statement handle
DB_common::expect_queries()
Set list of expected queries and returns
DB_common::expect_query()
Set expected query and return
DB_common::freePrepared()
Frees the internal resources associated with a prepared query
DB_common::getAll()
Fetches all of the rows from a query result
DB_common::getAssoc()
Fetches an entire query result and returns it as an associative array using the first column as the key
DB_common::getCol()
Fetches a single column from a query result and returns it as an indexed array
DB_common::getListOf()
Lists internal database information
DB_common::getOne()
Fetches the first column of the first row from a query result
DB_common::getOption()
Returns the value of an option
DB_common::getRow()
Fetches the first row of data returned from a query result
DB_common::getSequenceName()
Generates the name used inside the database for a sequence
DB_common::getSpecialQuery()
Obtains the query string needed for listing a given type of objects
DB_common::limitQuery()
Generates and executes a LIMIT query
DB_common::modifyLimitQuery()
Adds LIMIT clauses to a query string according to current DBMS standards
DB_common::modifyQuery()
Changes a query string for various DBMS specific reasons
DB_common::nextId()
Returns the next free id in a sequence
DB_common::numRows()
Determines the number of rows in a query result
DB_common::prepare()
Prepares a query for multiple execution with execute()
DB_common::provides()
Tells whether the present driver supports a given feature
DB_common::query()
Sends a query to the database server
DB_common::quoteIdentifier()
Quotes a string so it can be safely used as a table or column name
DB_common::quoteSmart()
Formats input so it can be safely used in a query
DB_common::raiseError()
Communicates an error and invoke error callbacks, etc
DB_common::rollback()
Reverts the current transaction
DB_common::setFetchMode()
Sets the fetch mode that should be used by default for query results
DB_common::setOption()
Sets run-time configuration options for PEAR DB
DB_common::tableInfo()
Returns information about a table or a result set
DB_common::tally_queries()
Verify that all expected queries have been received
DB_common::_convertNullArrayValuesToEmpty()
Converts all null values in an array to empty strings
DB_common::_rtrimArrayValues()
Right-trims all strings in an array
DB_common::__sleep()
Automatically indicates which properties should be saved when PHP's serialize() function is called
DB_common::__toString()
Automatic string conversion for PHP 5
DB_common::__wakeup()
Automatically reconnects to the database when PHP's unserialize() function is called

Class Details

[line 2596]
Mock DB_mysql class



[ Top ]


Class Methods


constructor DB_mysql [line 2604]

void DB_mysql( )

This constructor calls $this->DB_common()



[ Top ]

method affectedRows [line 2950]

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.
todo:  Implement mock DB_mysql::affectedRows()


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

[ Top ]

method autoCommit [line 2886]

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.
todo:  Implement mock DB_mysql::autoCommit()


Overrides DB_common::autoCommit() (Enables or disables automatic commits)

Parameters:

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

[ Top ]

method commit [line 2900]

int commit( )

Commits the current transaction



Tags:

return:  DB_OK on success. A DB_Error object on failure.
todo:  Implement mock DB_mysql::committ()


Overrides DB_common::commit() (Commits the current transaction)

[ Top ]

method connect [line 2617]

int connect( array $dsn, [bool $persistent = false])

Connect to the database server, log in and open the database



Tags:

return:  DB_OK on success. A DB_Error object on failure.
todo:  Implement mock DB_mysql::connect()


Parameters:

array   $dsn   the data source name
bool   $persistent   should the connection be persistent?

[ Top ]

method createSequence [line 3053]

int createSequence( string $seq_name)

Creates a new sequence



Tags:

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


Overrides DB_common::createSequence() (Creates a new sequence)

Parameters:

string   $seq_name   name of the new sequence

[ Top ]

method disconnect [line 2697]

bool disconnect( )

Disconnects from the database server



Tags:

return:  TRUE on success, FALSE on failure
todo:  Implement mock DB_mysql::disconnect()


[ Top ]

method dropSequence [line 3082]

int dropSequence( string $seq_name)

Deletes a sequence



Tags:

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


Overrides DB_common::dropSequence() (Deletes a sequence)

Parameters:

string   $seq_name   name of the sequence to be deleted

[ Top ]

method errorNative [line 3253]

int errorNative( )

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



Tags:

return:  the DBMS' error code
todo:  Implement mock DB_mysql::errorNative()


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

[ Top ]

method escapeSimple [line 3158]

string escapeSimple( string $str)

Escapes a string according to the current DBMS's standards



Tags:

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


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

Parameters:

string   $str   the string to be escaped

[ Top ]

method fetchInto [line 2779]

mixed fetchInto( resource $result, array &$arr, int $fetchmode, [int $rownum = null])

Places a row from the result set into the given array



Tags:

return:  DB_OK on success, NULL when the end of a result set is reached or on failure
todo:  Implement mock DB_mysql::fetchInto()
see:  DB_result::fetchInto()


Parameters:

resource   $result   the query result resource
array   $arr   the referenced array to put the data in
int   $fetchmode   how the resulting array should be indexed
int   $rownum   the row number to fetch (0 = first row)

[ Top ]

method freeResult [line 2825]

bool freeResult( resource $result)

Deletes the result set and frees the memory occupied by the result set

This method is not meant to be called directly. Use DB_result::free() instead. It can't be declared "protected" because DB_result is a separate object.




Tags:

return:  TRUE on success, FALSE if $result is invalid
todo:  Implement mock DB_mysql::freeResult()
see:  DB_result::free()


Parameters:

resource   $result   PHP's query result resource

[ Top ]

method getSpecialQuery [line 3302]

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
see:  DB_common::getListOf()


Overrides DB_common::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 modifyLimitQuery [line 3206]

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_mysql::modifyLimitQuery()


Overrides DB_common::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 3179]

string modifyQuery( string $query)

Changes a query string for various DBMS specific reasons

This little hack lets you know how many rows were deleted when running a "DELETE FROM table" query. Only implemented if the DB_PORTABILITY_DELETE_COUNT portability option is on.




Tags:

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


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

Parameters:

string   $query   the query string to modify

[ Top ]

method mysqlRaiseError [line 3227]

object the mysqlRaiseError( [int $errno = null])

Produces a DB_Error object regarding the current problem



Tags:

return:  DB_Error object
todo:  Implement mock DB_mysql::mysqlRaiseError()
see:  DB_common::raiseError(), DB_mysql::errorNative(), DB_common::errorCode()


Parameters:

int   $errno   if the error is being manually raised pass a DB_ERROR* constant here. If this isn't passed the error information gathered from the DBMS.

[ Top ]

method nextId [line 2973]

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.
todo:  Implement mock DB_mysql::nextId()
see:  DB_common::nextID(), DB_common::getSequenceName(), DB_mysql::createSequence(), DB_mysql::dropSequence()


Overrides DB_common::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 nextResult [line 2761]

false nextResult( a $result)

Move the internal mysql result pointer to the next available result

This method has not been implemented yet.




Parameters:

a   $result   valid sql result resource

[ Top ]

method numCols [line 2845]

int numCols( resource $result)

Gets the number of columns in a result set

This method is not meant to be called directly. Use DB_result::numCols() instead. It can't be declared "protected" because DB_result is a separate object.




Tags:

return:  the number of columns. A DB_Error object on failure.
todo:  Implement mock DB_mysql::numCols()
see:  DB_result::numCols()


Parameters:

resource   $result   PHP's query result resource

[ Top ]

method numRows [line 2868]

int numRows( resource $result)

Gets the number of rows in a result set

This method is not meant to be called directly. Use DB_result::numRows() instead. It can't be declared "protected" because DB_result is a separate object.




Tags:

return:  the number of rows. A DB_Error object on failure.
todo:  Implement mock DB_mysql::numRows()
see:  DB_result::numRows()


Overrides DB_common::numRows() (Determines the number of rows in a query result)

Parameters:

resource   $result   PHP's query result resource

[ Top ]

method quoteIdentifier [line 3145]

string quoteIdentifier( string $str)

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

MySQL can't handle the backtick character (`) in table or column names.




Tags:

return:  quoted identifier string
access:  private
see:  DB_common::quoteIdentifier()


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

Parameters:

string   $str   identifier name to be quoted

[ Top ]

method rollback [line 2924]

int rollback( )

Reverts the current transaction



Tags:

return:  DB_OK on success. A DB_Error object on failure.
todo:  Implement mock DB_mysql::rollback()


Overrides DB_common::rollback() (Reverts the current transaction)

[ Top ]

method simpleQuery [line 2718]

mixed simpleQuery( string $query)

Sends a query to the database server

Generally uses mysql_query(). If you want to use mysql_unbuffered_query() set the "result_buffering" option to 0 using setOptions(). This option was added in Release 1.7.0.




Tags:

return:  + a PHP result resrouce for successful SELECT queries
  • the DB_OK constant for other successful queries
  • a DB_Error object on failure
todo:  Implement mock DB_mysql::simpleQuery()


Parameters:

string   $query   the SQL query string

[ Top ]

method tableInfo [line 3274]

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.
todo:  Implement mock DB_mysql::tableInfo()
see:  DB_common::tableInfo()


Overrides DB_common::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   a valid tableInfo mode

[ Top ]

method _BCsequence [line 3096]

bool _BCsequence( string $seqname)

Backwards compatibility with old sequence emulation implementation (clean up the dupes)



Tags:

return:  true on success. A DB_Error object on failure.
access:  private
todo:  Implement mock DB_mysql::_BCsequence()


Parameters:

string   $seqname   the sequence name to clean up

[ Top ]


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