Abstract Class OCSP_DB

Description

--------------------------------------------------- Class OCSP_DB

Located in /db/OCSP_DB.phpclass (line 57)


	
			
Direct descendents
Class Description
 class OCSP_DB_mySQL handels mySQL database connections / operations
Variable Summary
 mixed $debugInsert
 boolean $iam_connected
 string $myConfFile
 string $myDB
 boolean $myServer
Method Summary
 void addColumn (string $aTable, string $colName,  &$dbDesc, [boolean $debug = False], array $dbDesc)
 string checkColName (string $aName)
 array getArray (string $aTable, array $conditions, [int $offset = 0], [int $limit = 0], [string $orderBy = ""], [boolean $debug = false])
 array getDBTblDesc (strint $table, [bool $debug = False])
 array getDBTblList ([bool $debug = False])
 string getDBType ()
 array getIndexedArray (string $aTable, array $conditions, string $idxCol, [mixed $valCols = null], [int $offset = 0], [int $limit = 0], [string $orderBy = ""], [boolean $debug = FALSE])
 string getMyConfFile ([boolean $fromUser = True], [ $fromSession = True], [boolean $debug = False])
 string getMyDBName ()
 mixed getOne (string $query)
 array getRow (string $table, array $filter, [boolean $debug = false])
 mixed insertArray (string $table, array $valueArr, [boolean $debug = False], [string $idFld = ""])
 boolean isConnected ()
 boolean isInit ()
 void &newDBConnect ([ $confFile = ""], [ $reconnect = FALSE], [ $debug = FALSE])
 string qs_getSlashedValue (string $aValue)
 string qs_getWhereIn (string $col, array $valArr, [boolean $valuesAreString = True])
 OCSP_CURSOR query ([string $aQuery = ""], [boolean $secMode = True], [boolean $withErrMsg = False], [boolean $autoFree = True], [boolean $useBuffer = True])
 array queryArray (string $aQuery, [int $keyFld = 0], [int $valueFld = 0], [boolean $secMode = True], [boolean $debug = False])
 void truncateTable (string $aTable, [boolean $backup = True])
 int updateArray (string $aTable, array $conditions, array $values, [int $limit = 0], [boolean $debug = false])
Variables
mixed $debugInsert = FALSE (line 108)

var boolean $debugInsert

  • since: pk-06-09-04
  • access: protected
boolean $iam_connected = FALSE (line 82)
  • since: pk-07-06-13
  • access: protected
boolean $iam_initialized = FALSE (line 89)
  • since: pk-07-06-13
  • access: protected
string $myConfFile = "" (line 75)
  • since: pk-07-06-13
  • access: protected
string $myDB = "" (line 101)
  • access: protected
boolean $myServer = "" (line 95)
  • access: protected
Methods
addColumn (line 622)

adds a column to a table

  • since: pk-04-10-08
  • access: public
void addColumn (string $aTable, string $colName,  &$dbDesc, [boolean $debug = False], array $dbDesc)
  • string $aTable
  • string $colName
  • array $dbDesc
  • boolean $debug
  • &$dbDesc

Redefined in descendants as:
checkColName (line 596)

returns a valid column name

  • since: pk-08-10-29
  • access: public
string checkColName (string $aName)
  • string $aName
getArray (line 336)

generates a query and returns an array of the resultset

limit <> a multidimensional array is returned (see queryArray) if limit = 1 a single array is returned (see quickQuery)

  • since: pk-07-06-29
  • access: public
array getArray (string $aTable, array $conditions, [int $offset = 0], [int $limit = 0], [string $orderBy = ""], [boolean $debug = false])
  • string $aTable: (the table name)
  • array $conditions: (array(COLUMN => VALUE)
  • int $offset
  • int $limit: (0 is unlimeted)
  • string $orderBy: (comma seperated list of fields to order)
  • boolean $debug

Redefined in descendants as:
getDBTblDesc (line 660)

returns an array with column description arrays for each column where column name is the array index

a column description array has the following elements

  • string ['TYPE'] (type of the column example varchar,int,...)
  • int ['LEN'] (length of the column if supported by type)
  • string ['FLAGS'] (mysql flags)
  • boolean ['AUTO_INCREMENT'] (does the column use auto values on insert)
  • boolean ['NULL'] (null allowed)
  • boolean ['PRIMARY_KEY'] (the column is part of the primary key)
  • boolean ['KEY'] (the column is part of a -none primary- key)
  • string ['COLNAME'] (the name of the column - same as array index should be)

array getDBTblDesc (strint $table, [bool $debug = False])
  • strint $table
  • bool $debug: pk-03-10-24

Redefined in descendants as:
getDBTblList (line 634)

returns an array with all tables in the database

array getDBTblList ([bool $debug = False])
  • bool $debug

Redefined in descendants as:
getDBType (line 219)

returns the database type

('mySQL' for example)

  • access: public
string getDBType ()

Redefined in descendants as:
getIndexedArray (line 366)

generates a query and returns an array of the resultset with $idxCol as index and $valCols as values

if $valCols is an array of column names this columns are added as array to the returned array if $valCols is empty the complete row is added to the return array else $row[$valCols] is added to the return (simple array)

limit <> a multidimensional array is returned (see queryArray) if limit = 1 a single array is returned (see quickQuery)

  • since: pk-08-03-28
  • access: public
array getIndexedArray (string $aTable, array $conditions, string $idxCol, [mixed $valCols = null], [int $offset = 0], [int $limit = 0], [string $orderBy = ""], [boolean $debug = FALSE])
  • string $aTable: (the table name)
  • array $conditions: (array(COLUMN => VALUE)
  • string $idxCol
  • mixed $valCols
  • int $offset
  • int $limit: (0 is unlimeted)
  • string $orderBy: (comma seperated list of fields to order)
  • boolean $debug
getMyConfFile (line 262)

can also be called without object OCSP_DB::getMyConfFile() if $this->myConfFile is empty the global dbConffile is returned

  • version: pk-08-06-06
string getMyConfFile ([boolean $fromUser = True], [ $fromSession = True], [boolean $debug = False])
  • boolean $fromUser: try to get the conffile from the current user
  • boolean $debug
  • $fromSession
getMyDBName (line 247)
  • access: public
string getMyDBName ()
getOne (line 408)

Runs the query provided and returns the data from the first column of the first row then frees the result set.

  • since: pk-07-08-07
mixed getOne (string $query)
  • string $query
getRow (line 430)

returns the first row matching $filter

  • version: pk-08-02-15 filter type like (~) added
array getRow (string $table, array $filter, [boolean $debug = false])
  • string $table
  • array $filter
  • boolean $debug
insertArray (line 515)

inserts a new row out of an array

returns the value of the auto_increment field (idFld) or True in case of an error it returns False

mixed insertArray (string $table, array $valueArr, [boolean $debug = False], [string $idFld = ""])
  • string $table
  • array $valueArr
  • boolean $debug
  • string $idFld

Redefined in descendants as:
isConnected (line 238)
  • access: public
boolean isConnected ()
isInit (line 229)
  • access: public
boolean isInit ()
newDBConnect (line 136)
void &newDBConnect ([ $confFile = ""], [ $reconnect = FALSE], [ $debug = FALSE])
  • $confFile
  • $reconnect
  • $debug
qs_getSlashedValue (line 568)

returns $aValue with slashes to use to create query strings

  • return: return something like
    1.      return "'".str_replace("'","\'",strval($aValue))."'";
  • access: public
string qs_getSlashedValue (string $aValue)
  • string $aValue

Redefined in descendants as:
qs_getWhereIn (line 582)

returns WHERE col IN($valArr)

  • abstract:
  • access: public
string qs_getWhereIn (string $col, array $valArr, [boolean $valuesAreString = True])
  • string $col
  • array $valArr
  • boolean $valuesAreString

Redefined in descendants as:
query (line 464)

opens a cursor for a query

OCSP_CURSOR query ([string $aQuery = ""], [boolean $secMode = True], [boolean $withErrMsg = False], [boolean $autoFree = True], [boolean $useBuffer = True])
  • string $aQuery: the sql query
  • boolean $secMode
  • boolean $withErrMsg
  • boolean $autoFree
  • boolean $useBuffer

Redefined in descendants as:
queryArray (line 497)

returns an array of table rows

if $keyFld == $valueFld a simple array is returned ( $array[]=$value )

if $keyFld != $valueFld a simple array is returned where $keyFld is used as index ( $array[$key]=$value )

if $valueFld == -1 a named 2 dimensonal array is returned ( $array[$key]=$row )

if $keyFld == -1 && $valueFld == -1 a 2 dimensonal array is returned ( $array[]=$row )

array queryArray (string $aQuery, [int $keyFld = 0], [int $valueFld = 0], [boolean $secMode = True], [boolean $debug = False])
  • string $aQuery: a sql select statement
  • int $keyFld: index of the key field in the select result (starts at 0)
  • int $valueFld: index of the value field in the select result (starts at 0)
  • boolean $secMode: check query whith DB_mySQL::checkQuery()
  • boolean $debug: show debug info

Redefined in descendants as:
truncateTable (line 546)

truncates a table

  • access: public
void truncateTable (string $aTable, [boolean $backup = True])
  • string $aTable
  • boolean $backup

Redefined in descendants as:
updateArray (line 534)

updates $values in $aTable where $conditions

  • return: number of effekted rows
  • abstract:
int updateArray (string $aTable, array $conditions, array $values, [int $limit = 0], [boolean $debug = false])
  • string $aTable
  • array $conditions
  • array $values
  • int $limit
  • boolean $debug

Redefined in descendants as:

Documentation generated on Thu, 08 Jan 2009 17:45:28 +0100 by phpDocumentor 1.4.0a2