Abstract Class AbstractDB_Driver

Description

AbstractDB Driver Base Class

Driver base class from which all other AbstractDB drivers extend.

  • abstract:

Located in /abstractdb_driver.class.php (line 27)


	
			
Direct descendents
Class Description
 class AbstractDB_MySQL AbstractDB MySQL Driver Class
Variable Summary
 array $Support
 array $_arguments
 resource $_connection
 string $_error
Method Summary
 AbstractDB_Driver AbstractDB_Driver (array $arguments)
 int AffectedRows ()
 void ClearError ()
 bool Close ()
 bool Connect ()
 bool DataSeek (resource &$rs, int $row_num)
 array FetchAssoc (resource &$rs)
 mixed FetchField (resource &$rs)
 object Returns FetchObject (resource &$rs)
 array FetchRow (resource &$rs)
 int FieldCount (resource &$rs)
 bool FieldNames (resource &$rs, array &$fields)
 bool FreeResult (resource &$rs)
 string GetLastError ()
 mixed InsertID ()
 resource Query (string $sql)
 resource Replace (string $table, array $fields)
 int RowCount (resource &$rs)
 mixed SetDatabase (string $dbName)
 void SetError (string $scope, string $message)
Variables
array $Support (line 55)

List of supported features of the currently loaded driver.

  • access: public
array $_arguments (line 35)

List of connection and driver specific arguments.

  • access: private
resource $_connection (line 41)

Database connection handle.

  • access: private
string $_error (line 47)

The last error message.

  • access: private
Methods
Constructor AbstractDB_Driver (line 66)

AbstractDB Driver Constructor

Initilises an instance of the AbstractDB Driver base class.

  • internal: Stores the arguments parameter as a local field.
  • access: public
AbstractDB_Driver AbstractDB_Driver (array $arguments)
  • array $arguments: A list of connection and driver specific arguments. See AbstractDB for details concerning connection arguments.
AffectedRows (line 83)

Gets the Number of Affected Rows

Gets the number of rows affected by the last query.

  • return: Returns the number of rows affected by the last executed query.
  • internal:

    This method must be overriden in extended classes with a call to parent if this feature is supported.

    If this feature is not supported an error should be set explaining this.

  • access: public
int AffectedRows ()

Redefined in descendants as:
ClearError (line 331)

Clears the latest error message.

  • access: private
void ClearError ()
Close (line 97)

Closes the Database Connection

  • return: Returns true if the database connection was successfully closed, otherwise false.
  • internal:

    This method must be overriden in extended classes with a call to parent if this feature is supported.

    If this feature is not supported this method should return a default value of true.

  • access: public
bool Close ()

Redefined in descendants as:
Connect (line 350)

Opens a Database Connection

Attempts to connect to the database using the parameters given in the constructor.

  • return: Returns true if the connection was successfully made, otherwise false.
  • internal:

    This method must be overriden in extended classes or it will cause the script to exit.

    The _connection field should be set to hold the resource link.

    If the connection fails an error should be set that explains as best as possible the reason for the connection failure.

  • access: private
bool Connect ()

Redefined in descendants as:
DataSeek (line 113)

Move a Result Pointer to the Specified Row

  • return: Returns true if the operation was successful, otherwise false.
  • internal:

    This method must be overriden in extended classes with a call to parent if this feature is supported.

    If this feature is not supported an error should be set explaining this.

  • access: public
bool DataSeek (resource &$rs, int $row_num)
  • resource $rs: A reference to a result handle returned by executing a query.
  • int $row_num: The 0 based index of the row that the result pointer should move to.

Redefined in descendants as:
FetchAssoc (line 128)

Fetches a Result Row as an Associative Array

  • return: Returns an associative array if the operation was successful, otherwise false.
  • internal:

    This method must be overriden in extended classes with a call to parent if this feature is supported.

    If this feature is not supported an error should be set explaining this.

  • access: public
array FetchAssoc (resource &$rs)
  • resource &$rs: A reference to a resource handle returned by executing a query.

Redefined in descendants as:
FetchField (line 143)

Fetches the First Field Value

Fetches the value from the first field of a result row.

  • return: Returns the field value if the operation was successful, otherwise false.
  • internal: This method must be overriden in extended classes with a call to parent.
  • access: public
mixed FetchField (resource &$rs)
  • resource &$rs: A reference to a resource handle returned by executing a query.

Redefined in descendants as:
FetchObject (line 158)

Fetches a Result Row as an Object

  • return: an object if the operation was successful, otherwise false.
  • internal:

    This method must be overriden in extended classes with a call to parent if this feature is supported.

    If this feature is not supported an error should be set explaining this.

  • access: public
object Returns FetchObject (resource &$rs)
  • resource &$rs: A reference to a resource handle returned by executing a query.

Redefined in descendants as:
FetchRow (line 171)

Fetches a Result Row

  • return: Returns an array if the operation was successful, otherwise false.
  • internal: This method must be overriden in extended classes with a call to parent.
  • access: public
array FetchRow (resource &$rs)
  • resource &$rs: A reference to a resource handle returned by executing a query.

Redefined in descendants as:
FieldCount (line 186)

Gets the Number of Fields

Gets the number of fields returned by given result handle.

  • return: Returns the number of fields returned by the last executed query.
  • internal: This method must be overriden in extended classes with a call to parent.
  • access: public
int FieldCount (resource &$rs)
  • resource $rs: A reference to a resource handle returned by executing a query.

Redefined in descendants as:
FieldNames (line 200)

Gets the Field Names of a Query

  • return: Returns true if the operation was successful, otherwise false.
  • internal: This method must be overriden in extended classes with a call to parent.
  • access: public
bool FieldNames (resource &$rs, array &$fields)
  • resource $rs: A reference to a resource handle returned by executing a query.
  • array $fields: A reference to an array that will contain the field names.

Redefined in descendants as:
FreeResult (line 217)

Frees a Result Resource

Frees the resources associated with the given result handle.

  • return: Returns true if the resource handle was successfully freed.
  • internal:

    This method must be overriden in extended classes with a call to parent if this feature is supported.

    If this feature is not supported the method should return a default value of true.

  • access: public
bool FreeResult (resource &$rs)
  • resource &$rs: A reference to a resource handle returned by executing a query.

Redefined in descendants as:
GetLastError (line 228)

Gets the Last Error.

  • return: The last error message.
  • access: public
string GetLastError ()
InsertID (line 244)

Gets the Last Inserted AUTO_INCREMENT ID

Gets the ID of the last AUTO_INCREMENT record inserted into the databse.

  • return: Returns either the ID of the last inserted AUTO_INCREMENT record, or -1 if the last query was not an insert.
  • internal:

    This method must be overriden in extended classes with a call to parent if this feature is supported.

    If this feature is not supported an error should be set explaining this.

  • access: public
mixed InsertID ()

Redefined in descendants as:
Query (line 264)

Executes an SQL Statement.

Executes an SQL statement passed in as a parameter.

  • return: If the query was successful, the result handle of the query used in result fetching functions, otherwise false.
  • internal:

    This method must be overriden in extended classes or it will cause the script to exit.

    If the query fails an error should be set that explains as best as possible the reason for the query failure.

  • access: public
resource Query (string $sql)
  • string $sql: The SQL statement to execute on the database.

Redefined in descendants as:
Replace (line 290)

Executes an SQL Replace Query

  • return: If the replace query was successful, the result handle of the query, otherwise false.
  • internal:

    This method must be overriden in extended classes with a call to parent if this feature is supported.

    If this feature is not supported an error should be set explaining this.

  • access: public
resource Replace (string $table, array $fields)
  • string $table: The name of the table to execute the replace query on.
  • array $fields:

    An associative array of field definitions. Keys should be the field names and values should be an associative array containing the following keys:

    Key => bool indicating that this field is the primary key or part of a unique index. Key values must not be NULL.

    Type => either "text", "numeric", "bool".

    Value => the value of the field.

    Null => bool indicating if the value of the field should be set to NULL.

    e.g. $fields = array("Field1" => array("Key" => true, "Type" => "numeric", "Value" => 123, "Null" => false));


Redefined in descendants as:
RowCount (line 305)

Gets the Number of Rows

Gets the number of rows returned by given result handle.

  • return: Returns the number of fields returned by the last executed query.
  • internal: This method must be overriden in extended classes with a call to parent.
  • access: public
int RowCount (resource &$rs)
  • resource $rs: A reference to a resource handle returned by executing a query.

Redefined in descendants as:
SetDatabase (line 320)

Sets the Current Active Database

  • return: The name of the previously active database, or false if an error occured.
  • internal:

    This method must be overriden in extended classes with a call to parent.

    If this operation fails an error should be set explaining as best as possible the reason for the failure.

  • access: public
mixed SetDatabase (string $dbName)
  • string $dbName: The name of the database to set active.

Redefined in descendants as:
SetError (line 361)

Sets the Error Message

  • access: private
void SetError (string $scope, string $message)
  • string $scope: The scope of the error, generally the function in which it occured.
  • string $message: The actual error message.

Documentation generated on Wed, 16 Mar 2005 23:17:11 +1100 by phpDocumentor 1.3.0RC3