Class DatabaseAbstract

Description

Greg MacLellan's Database Abstraction Layer

Currently only supports MySQL

  • since: Last Revised: May 17, 2002
  • version: 0.4.3
  • author: Greg MacLellan

Located in /dal.inc.php (line 36)


	
			
Variable Summary
mixed $debug
mixed $lasterror
mixed $result
Method Summary
DatabaseAbstract DatabaseAbstract (string $dbtype, string $dbhost, string $user, string $pass, [string $database = ""])
bool changeDB (string $database)
void error (mixed $query, mixed $error)
An getRow ([mixed $set = "default"])
void getRowRaw (mixed $result)
The numRows ([mixed $set = "default"])
The sqlExec (string $sql, [bool $returnid = false])
void sqlResult (string $sql, [string $set = "default"])
void sqlResultRaw (mixed $sql)
void sqlRow (string $sql, [mixed $type = MYSQL_BOTH])
Variables
mixed $debug = false (line 88)

Whether or not to use "debug mode". When debug mode is on, errors will terminate the current script and display the failed operation and error message. If debug is off, on an error nothing will be displayed.

mixed $lasterror (line 81)

The last error that occured

mixed $result (line 76)

array of result handles

Used for the different $sets

Methods
Constructor DatabaseAbstract (line 98)

Creates a new database object.

DatabaseAbstract DatabaseAbstract (string $dbtype, string $dbhost, string $user, string $pass, [string $database = ""])
  • string $dbtype: The type of database to connect to
  • string $dbhost: The hostname of the database server
  • string $user: The username to connect with
  • string $pass: The password to use
  • string $database: The database to use (optional)
changeDB (line 143)

Switched to the specified database name.

  • return: True if the database was successfully selected
bool changeDB (string $database)
  • string $database: The name of the database to use
error (line 131)

Terminate script if we're running debug, otherwise just save the error

void error (mixed $query, mixed $error)
getRow (line 215)

Puts the next row into an associative array.

  • return: array containing the next row, or False if there are no more rows
An getRow ([mixed $set = "default"])
  • mixed $set: Optional result set identifier. The set "default" is used if none is specified.
getRowRaw (line 247)

raw mysql_fetch_array

void getRowRaw (mixed $result)
numRows (line 229)

Finds the number of rows in the result set

  • return: number of rows
The numRows ([mixed $set = "default"])
  • mixed $set: Optional result set identifier. The set "default" is used if none is specified.
sqlExec (line 164)

Executes an SQL query without storing the result. Useful for INSERT, UPDATE, etc

  • return: result handle, or if $returnid is true, the last insertid
The sqlExec (string $sql, [bool $returnid = false])
  • string $sql: The SQL code to execute
  • bool $returnid: If true, returns the last insert ID (only supported on mysql,)
sqlResult (line 183)

Executes an SQL query and stores the result.

void sqlResult (string $sql, [string $set = "default"])
  • string $sql: The SQL code to execute
  • string $set: The optional set name to store the results in. By default, the name is "default". Only one result set can be stored with the same name at a time.
sqlResultRaw (line 238)

raw mysql_query

void sqlResultRaw (mixed $sql)
sqlRow (line 198)

Executes an SQL query and gets only one row

void sqlRow (string $sql, [mixed $type = MYSQL_BOTH])
  • string $sql: The SQL code to execute

Documentation generated on Thu, 27 Nov 2003 14:58:52 -0500 by phpDocumentor 1.2.3