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).

Definition at line 15 of file DBI.php5.


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

Definition at line 36 of file DBI.php5.

References setError().

DBI::__destruct (  ) 

Called when the object is destroyed.

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

Definition at line 69 of file DBI.php5.

References SConfig::getOption().


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

Definition at line 258 of file DBI.php5.

DBI::getDB (  ) 

Get the database object.

Returns:
php mysql database object

Definition at line 219 of file DBI.php5.

DBI::getDBName (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 230 of file DBI.php5.

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

Definition at line 151 of file DBI.php5.

DBI::getQuery (  ) 

Get the last query used.

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

Definition at line 238 of file DBI.php5.

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

Definition at line 199 of file DBI.php5.

Referenced by query().

DBI::hasError (  ) 

INSERT BRIEF DESCRIPTION HERE.

INSERT FULL DESCRIPTION HERE

Returns:
[TYPE]: RETURN DESCRIPTION

Definition at line 168 of file DBI.php5.

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)

Definition at line 250 of file DBI.php5.

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

Definition at line 89 of file DBI.php5.

References SConfig::getOption(), getResult(), SErrorManager::setWarning(), and SErrorManager::sobj_setDebug().

DBI::setError ( errorMessage  ) 

Set (report) an error on this object.

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

Definition at line 142 of file DBI.php5.

Referenced by __construct().

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

Definition at line 189 of file DBI.php5.


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

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