Class AbstractDB

Description

Abstract base class for db access

This class defines the interface for all the implementing layers.

Don't call or instanciate this class.

Located in /core/anyDB/base/AbstractDB.php (line 52)

UtilityClass
   |
   --AbstractDB
Direct descendents
Class Description
BasicDB Essential functionality for the db class
Variable Summary
String $database
Mixed $db
String $error
Array $errors
String $host
String $lastQuery
String $password
Boolean $persistent
Integer $prefResType
mixed $pushError
Array $queries
Mixed $result
String $user
Method Summary
AbstractDB AbstractDB (String $libraryPath, String $dbType, [Integer $preferredResType = ANYDB_RES_ASSOC])
Mixed affectedRows ()
Boolean connect (String $host, String $db, String $user, String $password, [mixed $persistent = false], Boolean $persistent )
Boolean disconnect ()
Mixed escapeStr (Mixed $str, [Array $keys = null])
Mixed execute (String $query, [Integer $resultType = ANYDB_PREDEFINED_VALUE])
Mixed free ()
Mixed getAll ([Integer $resultType = ANYDB_PREDEFINED_VALUE])
Mixed getColumn ([Integer $resultType = ANYDB_PREDEFINED_VALUE])
Mixed getDataId (String $table, Array $array, [Array $fields = null], [String $id_field = 'id'])
Mixed getDBs ()
String getDbType ()
Mixed getIdentifier ()
Mixed getInsertId ()
Mixed getMapped (String $key)
Mixed getNext ([Integer $resultType = ANYDB_PREDEFINED_VALUE])
Mixed getTables ()
Mixed getValue ([mixed $resultType = ANYDB_STRING])
Integer getVersion ()
Mixed numRows ()
Boolean query (mixed $query, String $query )
Boolean setDB ()
Variables
String $database = '' (line 86)

db name

  • access: public
Mixed $db = null (line 110)

database resource

  • access: public
String $error = '' (line 150)

last error

  • access: public
Array $errors = array() (line 158)

error array

  • access: public
String $host = '' (line 79)

db host name

  • access: public
String $lastQuery = '' (line 134)

the last submitted query

  • access: public
String $password = '' (line 102)

user password

  • access: public
Boolean $persistent (line 142)

use a persistent db connection?

  • access: public
Integer $prefResType (line 126)

the preferred result type

  • access: public
mixed $pushError = false (line 169)
Array $queries = array() (line 166)

error array

  • access: public
Mixed $result = null (line 118)

result resource

  • access: public
String $user = '' (line 94)

user name

  • access: public
Methods
Constructor AbstractDB (line 185)

Constructor

  • access: public
  • abstract:
AbstractDB AbstractDB (String $libraryPath, String $dbType, [Integer $preferredResType = ANYDB_RES_ASSOC])
  • String $libraryPath: path to the database abstraction layer
  • String $dbType: identifier of the db type
  • Integer $preferredResType: the preferred result type
affectedRows (line 379)

Returns how many rows were affected by the last statement

  • return: Integer or FALSE
  • access: public
  • abstract:
Mixed affectedRows ()

Redefined in descendants as:
connect (line 205)

Connects to the db

  • return: TRUE, if successful
  • access: public
  • abstract:
Boolean connect (String $host, String $db, String $user, String $password, [mixed $persistent = false], Boolean $persistent )
  • String $host
  • String $db
  • String $user
  • String $password
  • Boolean $persistent

Redefined in descendants as:
disconnect (line 217)

Closes the db connection

  • return: TRUE, if successful
  • access: public
  • abstract:
Boolean disconnect ()

Redefined in descendants as:
escapeStr (line 441)

Modifies a string to make it secure to add to the db

  • return: String or FALSE
  • access: public
  • abstract:
Mixed escapeStr (Mixed $str, [Array $keys = null])
  • Mixed $str: a string or an array
  • Array $keys: if not null it specifies which key names to use

Redefined in descendants as:
execute (line 315)

Executes a statement and returns the result table

  • return: 2-dimensional array or FALSE
  • access: public
  • abstract:
Mixed execute (String $query, [Integer $resultType = ANYDB_PREDEFINED_VALUE])
  • String $query: a sql statement
  • Integer $resultType: should the array have numeric, associative keys, or both

Redefined in descendants as:
free (line 355)

Frees the memory from the result set

  • return: TRUE, if successful
  • access: public
  • abstract:
Mixed free ()

Redefined in descendants as:
getAll (line 260)

Returns the resulting table in an 2-dimensional array

  • return: 2-dimensional array
  • access: public
  • abstract:
Mixed getAll ([Integer $resultType = ANYDB_PREDEFINED_VALUE])
  • Integer $resultType: should the array have numeric, associative keys, or both

Redefined in descendants as:
getColumn (line 286)

Returns a result column after an apropriate sql statement

  • return: 1-dimensional array or FALSE
  • access: public
  • abstract:
Mixed getColumn ([Integer $resultType = ANYDB_PREDEFINED_VALUE])
  • Integer $resultType: should the array have numeric, associative keys, or both

Redefined in descendants as:
getDataId (line 344)

Checks if a dataset exists and returns the id if so

  • return: id on hit or FALSE, null on ERROR
  • access: public
  • abstract:
Mixed getDataId (String $table, Array $array, [Array $fields = null], [String $id_field = 'id'])
  • String $table: the table name
  • Array $array: the array to be checked
  • Array $fields: what fields to be checked
  • String $id_field: id field name

Redefined in descendants as:
getDBs (line 464)

Returns the names of the available dbs

  • return: Array or FALSE
  • access: public
  • abstract:
Mixed getDBs ()

Redefined in descendants as:
getDbType (line 403)

Returns the db type identifier

  • access: public
  • abstract:
String getDbType ()

Redefined in descendants as:
getIdentifier (line 391)

return id string

  • return: String or FALSE
  • access: public
  • abstract:
Mixed getIdentifier ()

Redefined in descendants as:
getInsertId (line 327)

Returns the id of the last insert operation

  • return: int or FALSE
  • access: public
  • abstract:
Mixed getInsertId ()

Redefined in descendants as:
getMapped (line 300)

Returns the resulting table but uses the $key field as an index

  • return: 1- or 2-dimensional array or FALSE
  • access: public
  • abstract:
Mixed getMapped (String $key)
  • String $key: the index key

Redefined in descendants as:
getNext (line 246)

Returns the next row in an array

  • return: 1-dimensional array or FALSE
  • access: public
  • abstract:
Mixed getNext ([Integer $resultType = ANYDB_PREDEFINED_VALUE])
  • Integer $resultType: should the array have numeric, associative keys, or both

Redefined in descendants as:
getTables (line 453)

Returns the table names of the current db

  • return: Array or FALSE
  • access: public
  • abstract:
Mixed getTables ()

Redefined in descendants as:
getValue (line 272)

Returns a single value after an apropriate sql statement

  • return: String or FALSE
  • access: public
  • abstract:
Mixed getValue ([mixed $resultType = ANYDB_STRING])

Redefined in descendants as:
getVersion (line 415)

Returns the current version

  • access: public
  • abstract:
Integer getVersion ()

Redefined in descendants as:
numRows (line 367)

Returns how many rows are in the result set

  • return: TRUE, if successful
  • access: public
  • abstract:
Mixed numRows ()

Redefined in descendants as:
query (line 232)

Submits an sql statement to the db

  • return: TRUE, if successful
  • access: public
  • abstract:
Boolean query (mixed $query, String $query )
  • String $query

Redefined in descendants as:
setDB (line 426)

Changes the current database

  • access: public
  • abstract:
Boolean setDB ()

Redefined in descendants as:

Inherited Methods

Inherited From UtilityClass

UtilityClass::UtilityClass()

Documentation generated on Tue, 4 Oct 2005 21:58:43 -0700 by phpDocumentor 1.3.0RC3