Class BasicDB

Description

Essential functionality for the db class

This class implements the essential functions for all the implementing layers.
Don't call or instanciate this class.

  • access: public
  • version: 11/18/04
  • abstract:
  • copyright: Lennart Groetzbach <lennartg[at]web.de> - distributed under the LGPL
  • author: Lennart Groetzbach <lennartg[at]web.de>
  • link: for the latest version

Located in /core/anyDB/base/BasicDB.php (line 25)

UtilityClass
   |
   --AbstractDB
      |
      --BasicDB
Direct descendents
Class Description
ADOdbDB Implementation for ADODB
MetabaseDB Implementation for Metabase
MysqlDB Implementation for mysql Made for php version >= 4.x Tested with mysql 4.0.17
OdbcDB Implementation for ODBC
PearDB Implementation for PEAR
PostgresDB Implementation for PostgreSQL
SQLiteDB Implementation for SQLite
Method Summary
BasicDB BasicDB (String $libraryPath, String $dbType, [Integer $preferredResType = ANYDB_RES_ASSOC])
Boolean connect (String $host, String $db, String $user, String $password, [mixed $persistent = false], Boolean $persistent )
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])
void getColumnDescr (mixed $table)
Mixed getDataId (String $table, Array $array, [Array $fields = null], [String $id_field = 'id'])
void getDBs ()
String getDbType ()
Mixed getIdentifier ()
Mixed getInsertId ()
Mixed getMapped (String $key)
Mixed getTables ()
Mixed getValue ([mixed $resultType = ANYDB_STRING])
Boolean query (mixed $query, String $query )
Boolean setDB (mixed $database)
void _addError (mixed $err_str, mixed $where)
void _trace ()
Variables
Methods
Constructor BasicDB (line 76)

Constructor

  • access: public
  • abstract:
BasicDB BasicDB (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
connect (line 111)

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

Redefinition of:
AbstractDB::connect()
Connects to the db

Redefined in descendants as:
escapeStr (line 444)

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

Redefinition of:
AbstractDB::escapeStr()
Modifies a string to make it secure to add to the db
execute (line 230)

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

Redefinition of:
AbstractDB::execute()
Executes a statement and returns the result table
free (line 315)

Frees the memory from the result set

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

Redefinition of:
AbstractDB::free()
Frees the memory from the result set

Redefined in descendants as:
getAll (line 179)

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

Redefinition of:
AbstractDB::getAll()
Returns the resulting table in an 2-dimensional array

Redefined in descendants as:
getColumn (line 248)

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

Redefinition of:
AbstractDB::getColumn()
Returns a result column after an apropriate sql statement

Redefined in descendants as:
getColumnDescr (line 346)
void getColumnDescr (mixed $table)
getDataId (line 581)

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

Redefinition of:
AbstractDB::getDataId()
Checks if a dataset exists and returns the id if so
getDBs (line 428)
void getDBs ()

Redefinition of:
AbstractDB::getDBs()
Returns the names of the available dbs

Redefined in descendants as:
getDbType (line 328)

Returns the db type identifier

  • access: public
  • abstract:
String getDbType ()

Redefinition of:
AbstractDB::getDbType()
Returns the db type identifier
getIdentifier (line 341)

return id string

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

Redefinition of:
AbstractDB::getIdentifier()
return id string
getInsertId (line 527)

Returns the id of the last insert operation

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

Redefinition of:
AbstractDB::getInsertId()
Returns the id of the last insert operation

Redefined in descendants as:
getMapped (line 280)

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

Redefinition of:
AbstractDB::getMapped()
Returns the resulting table but uses the $key field as an index
getTables (line 366)

Returns the table names of the current db

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

Redefinition of:
AbstractDB::getTables()
Returns the table names of the current db

Redefined in descendants as:
getValue (line 201)

Returns a single value after an apropriate sql statement

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

Redefinition of:
AbstractDB::getValue()
Returns a single value after an apropriate sql statement

Redefined in descendants as:
query (line 145)

Submits an sql statement to the db

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

Redefinition of:
AbstractDB::query()
Submits an sql statement to the db

Redefined in descendants as:
setDB (line 129)

Changes the current database

  • access: public
  • abstract:
Boolean setDB (mixed $database)

Redefinition of:
AbstractDB::setDB()
Changes the current database

Redefined in descendants as:
_addError (line 691)
void _addError (mixed $err_str, mixed $where)
_trace (line 678)
void _trace ()

Inherited Methods

Inherited From AbstractDB

AbstractDB::AbstractDB()
AbstractDB::affectedRows()
AbstractDB::connect()
AbstractDB::disconnect()
AbstractDB::escapeStr()
AbstractDB::execute()
AbstractDB::free()
AbstractDB::getAll()
AbstractDB::getColumn()
AbstractDB::getDataId()
AbstractDB::getDBs()
AbstractDB::getDbType()
AbstractDB::getIdentifier()
AbstractDB::getInsertId()
AbstractDB::getMapped()
AbstractDB::getNext()
AbstractDB::getTables()
AbstractDB::getValue()
AbstractDB::getVersion()
AbstractDB::numRows()
AbstractDB::query()
AbstractDB::setDB()

Inherited From UtilityClass

UtilityClass::UtilityClass()

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