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

Class: DB

Source Location: /test/mockDB/DB.php

Class Overview


Mock DB class for testing


Methods



Class Details

[line 322]
Mock DB class for testing

This class is a mock version of the PEAR DB class. It is intended to provide the same interface as the real DB class, plus a small database sufficient to test software.




[ Top ]


Class Methods


method apiVersion [line 409]

string apiVersion( )

Return the DB API version



Tags:

return:  the DB API version number


[ Top ]

method connect [line 379]

object a &connect( mixed $dsn, [array $options = array()])

Create a new DB object including a connection to the specified database



Tags:

return:  new DB object. A DB_Error object on failure.
todo:  Implement mock DB::connect
uses:  DB::parseDSN(), - DB_common::setOption(), PEAR::isError()


Parameters:

mixed   $dsn   the string "data source name" or array in the format returned by DB::parseDSN()
array   $options   an associative array of option names and values

[ Top ]

method errorMessage [line 466]

string errorMessage( integer $value)

Return a textual error message for a DB error code



Tags:

return:  the error message or false if the error code was not recognized
access:  public
todo:  Implement mock DB::errorMessage


Parameters:

integer   $value   the DB error code

[ Top ]

method factory [line 334]

object a &factory( string $type, [array $options = false])

Create a new DB object for the specified database type but don't connect to the database



Tags:

return:  new DB object. A DB_Error object on failure.
access:  public
todo:  Implement mock DB::factory
see:  DB_common::setOption()


Parameters:

string   $type   the database type (eg "mysql")
array   $options   an associative array of option names and values

[ Top ]

method isConnection [line 432]

bool isConnection( mixed $value)

Determines if a value is a DB_<driver> object



Tags:

return:  whether $value is a DB_<driver> object
todo:  Implement mock DB::isConnection


Parameters:

mixed   $value   the value to test

[ Top ]

method isError [line 420]

bool isError( mixed $value)

Determines if a variable is a DB_Error object



Tags:

return:  whether $value is DB_Error object


Parameters:

mixed   $value   the variable to check

[ Top ]

method isManip [line 445]

boolean isManip( string $query)

Tell whether a query is a data manipulation or data definition query



Tags:

return:  whether $query is a data manipulation query


Parameters:

string   $query   the query

[ Top ]

method parseDSN [line 524]

array parseDSN( string $dsn)

Parse a data source name



Tags:

return:  an associative array with the following keys:
  • phptype: Database backend used in PHP (mysql, odbc etc.)
  • dbsyntax: Database used with regards to SQL syntax etc.
  • protocol: Communication protocol to use (tcp, unix etc.)
  • hostspec: Host specification (hostname[:port])
  • database: Database to use on the DBMS server
  • username: User name for login
  • password: Password for login
access:  public
todo:  Implement mock DB::parseDSN


Parameters:

string   $dsn   Data Source Name to be parsed

[ Top ]


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