adds a column to a table
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:
returns a valid column name
string
checkColName
(string $aName)
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)
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:
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:
returns an array with all tables in the database
array
getDBTblList
([bool $debug = False])
Redefined in descendants as:
returns the database type
('mySQL' for example)
string
getDBType
()
Redefined in descendants as:
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)
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
can also be called without object OCSP_DB::getMyConfFile() if $this->myConfFile is empty the global dbConffile is returned
string
getMyConfFile
([boolean $fromUser = True], [ $fromSession = True], [boolean $debug = False])
-
boolean
$fromUser: try to get the conffile from the current user
-
boolean
$debug
-
$fromSession
Runs the query provided and returns the data from the first column of the first row then frees the result set.
mixed
getOne
(string $query)
returns the first row matching $filter
array
getRow
(string $table, array $filter, [boolean $debug = false])
-
string
$table
-
array
$filter
-
boolean
$debug
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:
void
&newDBConnect
([ $confFile = ""], [ $reconnect = FALSE], [ $debug = FALSE])
-
$confFile
-
$reconnect
-
$debug
returns $aValue with slashes to use to create query strings
string
qs_getSlashedValue
(string $aValue)
Redefined in descendants as:
returns WHERE col IN($valArr)
string
qs_getWhereIn
(string $col, array $valArr, [boolean $valuesAreString = True])
-
string
$col
-
array
$valArr
-
boolean
$valuesAreString
Redefined in descendants as:
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:
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:
truncates a table
void
truncateTable
(string $aTable, [boolean $backup = True])
-
string
$aTable
-
boolean
$backup
Redefined in descendants as:
updates $values in $aTable where $conditions
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: