DBI Class Reference
[Database Interfaces]

(DEPRECATED) Use this class to connect to and query an external database More...

List of all members.

Public Member Functions

 __construct ($user="", $pass="", $db="", $server="", $port="3306")
 Establish a database connection.
 __destruct ()
 Called when the object is destroyed.
 clearErrors ()
 Clear any errors that have been set on this object.
 fieldName ()
 Get the field names from the result of the last query.
 getDB ()
 Get the database object.
 getDBName ()
 INSERT BRIEF DESCRIPTION HERE.
 getError ($pos="")
 Get a list of the errors set on this object, or a single error message.
 getQuery ()
 Get the last query used.
 getResult ($index="")
 Get the (cached) results for a given query to the database.
 hasError ()
 INSERT BRIEF DESCRIPTION HERE.
 mysql_insert_id ()
 Get the last mysql_insert_id.
 query ($query, $queryInfo=false)
 Run a query on the database.
 setError ($errorMessage)
 Set (report) an error on this object.
 setResult ($resultIndex, $resultIn)
 Store (cache) the results for a given query to the database.


Detailed Description

(DEPRECATED) Use this class to connect to and query an external database

Date:
11/21/2005
Author:
Monte D. Evans mevans@shodor.org
This PHP class is a generic template class for connecting to an external database system. The class only provides the framework for other classes to replace with their specific functionality. It provides the infrastructure for the Component (or Common) Database Interface (CDI).

Constructor & Destructor Documentation

DBI::__construct ( user = "",
pass = "",
db = "",
server = "",
port = "3306" 
)

Establish a database connection.

Parameters:
$user [string]: Database username
$pass [string]: Database password
$db [string]: Database name
$server [string]: Database server name
$port [int]: Database port number

DBI::__destruct (  ) 

Called when the object is destroyed.

Prints out the total DBI time used if common.debugQueries is on


Member Function Documentation

DBI::fieldName (  ) 

Get the field names from the result of the last query.

Returns:
[array] The field names returned by the last query

DBI::getDB (  ) 

Get the database object.

Returns:
php mysql database object

DBI::getDBName (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

DBI::getError ( pos = ""  ) 

Get a list of the errors set on this object, or a single error message.

Parameters:
$pos [int]: Get the error message at index $pos
Returns:
[mixed]: An array of errors by default, or a single error string if an index is given

DBI::getQuery (  ) 

Get the last query used.

Returns:
[SQL]: The most recent SQL query object

DBI::getResult ( index = ""  ) 

Get the (cached) results for a given query to the database.

Parameters:
$index [string]: The index at which the results were cached -- normally use the query as the index. If no index is defined, return all stored results.
Returns:
[array]: The array of cached results

DBI::hasError (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

DBI::mysql_insert_id (  ) 

Get the last mysql_insert_id.

Returns:
[int]: The most recent mysql_insert_id (the unique id of the last row inserted)

DBI::query ( query,
queryInfo = false 
)

Run a query on the database.

Parameters:
$query [string]: The SQL query to be run
$queryInfo [bool]: Should the returned array have additional query info stored? (optional, false by default)
Returns:
[array]: A 2-D array of the results, indexed by row number, column name

DBI::setError ( errorMessage  ) 

Set (report) an error on this object.

Parameters:
$errorMessage [string]: The error to be set

DBI::setResult ( resultIndex,
resultIn 
)

Store (cache) the results for a given query to the database.

Parameters:
$resultIndex [string]: The index at which we should cache the result (normally use the query as the index)
$resultIn [array]: The result to be cached at this index


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:02:17 2010 for Common by  doxygen 1.5.6