Zikula: A Flexible Open Source Content Management System
home | forum | international support | contact us

Docs For Class DBUtil

Class: DBUtil

Source Location: /pnobjlib/DBUtil.class.php

Class Overview


DBUtil

Methods


Inherited Variables

Inherited Methods


Class Details

[line 19] DBUtil



[ Top ]

Class Methods


method addColumn [line 2641]

void addColumn( tablename $tablename, fields $fields)

add column(s) to a table



Tags:

author:  Robert Gasch


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
fields   $fields   fields to add to the table return bool

[ Top ]

method changeTable [line 2349]

bool changeTable( tablename $tablename, [sql $sql = null], [tabopt $tabopt = null])

change database table using ADODB dictionary method



Tags:

author:  Drak


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
sql   $sql   ADODB dictionary representation of table (optional) (default=null)
tabopt   $tabopt   Table options specific to this table (optional) (default=null)

[ Top ]

method createDatabase [line 2942]

bool createDatabase( dbname $dbname, [optionsarray $optionsarray = false])

create database



Tags:

author:  Drak


Parameters:

dbname   $dbname   the database name
optionsarray   $optionsarray   the options array

[ Top ]

method createIndex [line 2506]

void createIndex( idxname $idxname, tablename $tablename, flds $flds, [idxoptarray $idxoptarray = false])

create index on table



Tags:

author:  Drak


Parameters:

idxname   $idxname  
tablename   $tablename   The tablename key for the PNTables structure
flds   $flds   string field name, or non-associative array of field names
idxoptarray   $idxoptarray   return bool

[ Top ]

method createTable [line 2298]

bool createTable( tablename $tablename, [sql $sql = null], [tabopt $tabopt = null])

create a database table using ADODB dictionary method



Tags:

author:  Drak


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
sql   $sql   ADODB dictionary representation of table (optional) (default=null)
tabopt   $tabopt   Table options specific to this table (optional) (default=null)

[ Top ]

method decrementObjectFieldByID [line 2037]

The decrementObjectFieldByID( tablename $tablename, decfield $decfield, id $id, [idfield $idfield = 'id'], [deccount $deccount = 1])

Loop through the array and feed it to DBUtil::insertObject()



Tags:

return:  result from the decrement operation


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
decfield   $decfield   The column which stores the field to increment
id   $id   The ID value of the object holding the field we wish to increment
idfield   $idfield   The idfield to use (optional) (default='id')
deccount   $deccount   The amount by which to decrement the field (optional) (default=1);

[ Top ]

method deleteObject [line 2089]

The deleteObject( object The $object, tablename $tablename, [where $where = ''], [idcolumn $idcolumn = 'id'])

Generate and execute a delete SQL statement for the given object



Tags:

return:  result from the delete operation


Parameters:

object The   $object   object we wish to update
tablename   $tablename   The tablename key for the PNTables structure
where   $where   The where clause to use (optional) (default='')
idcolumn   $idcolumn   The column which contains the ID field (optional) (default='id')

[ Top ]

method deleteObjectByID [line 2071]

The deleteObjectByID( tablename $tablename, id $id, [idcolumn $idcolumn = 'id'])

Delete an object by its ID.



Tags:

return:  result from the delete operation


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
id   $id   The ID of the object to delete
idcolumn   $idcolumn   The column which contains the ID field (optional) (default='id')

[ Top ]

method deleteObjectsFromKeyArray [line 2181]

void deleteObjectsFromKeyArray( $keyarray, $tablename, [ $field = 'id'])





Parameters:

   $keyarray  
   $tablename  
   $field  

[ Top ]

method deleteWhere [line 2051]

The deleteWhere( tablename $tablename, where $where)

Delete (an) object(s) via a where clause



Tags:

return:  result from the delete operation


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
where   $where   The where-clause to use

[ Top ]

method dropColumn [line 2681]

void dropColumn( tablename $tablename, fields $fields)

drop column(s) from a table



Tags:

author:  Mark West


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
fields   $fields   fields to drop from the table return bool

[ Top ]

method dropIndex [line 2568]

void dropIndex( idxname $idxname, tablename $tablename)

drop index on table



Tags:

author:  Drak


Parameters:

idxname   $idxname   index name
tablename   $tablename   The tablename key for the PNTables structure return bool

[ Top ]

method dropTable [line 2460]

bool dropTable( tablename $tablename)

delete database table





Parameters:

tablename   $tablename   The tablename key for the PNTables structure

[ Top ]

method executeSQL [line 56]

mixed executeSQL( sql $sql, [limitOffset $limitOffset = -1], [limitNumRows $limitNumRows = -1], [sql $exitOnError = true], [exitOnError $verbose = true], verbose 5)

Execute SQL, check for errors and return result. Uses Adodb to generate DB-portable paging code.



Tags:

return:  The result set of the successfully executed query or false on error


Parameters:

verbose   5   whether to be verbose (default=true) (optional)
sql   $sql   The SQL statement to execute
limitOffset   $limitOffset   The lower limit bound (optional) (default=-1)
limitNumRows   $limitNumRows   The upper limit bound (optional) (default=-1)
sql   $exitOnError   The SQL statement to execute
exitOnError   $verbose   whether to exit on error (default=true) (optional)

[ Top ]

method generateCategoryFilterWhere [line 803]

The generateCategoryFilterWhere( tablename $tablename, where $where, categoryFilter $categoryFilter, [returnArray $returnArray = false])

Append the approriate category filter where-clause to the given where clause.



Tags:

return:  resulting string or array


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
where   $where   The where clause (optional) (default='')
categoryFilter   $categoryFilter   The category list to use for filtering
returnArray   $returnArray   Whether or not to return an array (optional) (default=false)

[ Top ]

method getColumnsArray [line 458]

The getColumnsArray( tablename $tablename, [columnArray $columnArray = null])

return the column array for the given table



Tags:

return:  column array for the given table


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
columnArray   $columnArray   The columns to marshall into the resulting object (optional) (default=null)

[ Top ]

method getInsertID [line 2205]

void getInsertID( $tablename, [ $field = 'id'], [ $exitOnError = true], [ $verbose = true])





Parameters:

   $tablename  
   $field  
   $exitOnError  
   $verbose  

[ Top ]

method getLimitedTablename [line 2969]

bool getLimitedTablename( $tablename $tablename, [$dbdriver $dbdriver = ''])

limit the table name if necessary and prepend the prefix

When using Oracle the object name may not be longer than 30 chars. Now ADODB uses TRIGGERS and SEQUENCEs to emulate the AUTOINCREMENT which eats up to 9 chars (TRIG_SEQ_<prefix>_<tablename>) so we have to limit the length of the table name to 30 - 9 - length(prefix) - separator. We use this function as a central point to shorten table name (there might be restrictions in ' other RDBMS too). If the resulting tablename is empty we will show an error. In this case the prefix is too long.




Tags:

author:  landseer


Parameters:

$tablename   $tablename   the tablename as send from pntables.php
$dbdriver   $dbdriver   (optional) the driver used for this DB

[ Top ]

method getTableConstraints [line 2268]

void getTableConstraints( $tablename)

get the table constraints from the pntables array



Tags:

author:  Jose Guevara, UnderMedia S.A


Parameters:

   $tablename  

[ Top ]

method getTableDefinition [line 2229]

void getTableDefinition( $tablename)

get the table definition from the pntables array





Parameters:

   $tablename  

[ Top ]

method incrementObjectFieldByID [line 2009]

The incrementObjectFieldByID( tablename $tablename, incfield $incfield, id $id, [idfield $idfield = 'id'], [inccount $inccount = 1])

Increment a field by the given increment



Tags:

return:  result from the increment operation


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
incfield   $incfield   The column which stores the field to increment
id   $id   The ID value of the object holding the field we wish to increment
idfield   $idfield   The idfield to use (optional) (default='id')
inccount   $inccount   The amount by which to increment the field (optional) (default=1);

[ Top ]

method insertObject [line 1704]

The insertObject( object The &$object, tablename $tablename, [idcolumn $idcolumn = 'id'], [preserve $preserve = false], [force $force = false])

Generate and execute an insert SQL statement for the given object



Tags:

return:  result set from the update operation. The object is updated with the newly generated ID.


Parameters:

object The   &$object   object we wish to insert
tablename   $tablename   The tablename key for the PNTables structure
idcolumn   $idcolumn   The column which stores the primary key (optional) (default='id')
preserve   $preserve   whether or not to preserve existing/set standard fields (optional) (default=false)
force   $force   whether or not to insert empty values as NULL (optional) (default=false)

[ Top ]

method insertObjectArray [line 1674]

The insertObjectArray( objects &$objects, tablename $tablename, [idcolumn $idcolumn = 'id'], [preserve $preserve = false], [force $force = false])

Loop through the array and feed it to DBUtil::insertObject()



Tags:

return:  result set from the last insert operation. The objects are updated with the newly generated ID.


Parameters:

objects   &$objects   The objectArray we wish to insert
tablename   $tablename   The tablename key for the PNTables structure
idcolumn   $idcolumn   The column which stores the primary key (optional) (default='id')
preserve   $preserve   whether or not to preserve existing/set standard fields (optional) (default=false)
force   $force   whether or not to insert empty values as NULL (optional) (default=false)

[ Top ]

method marshallFieldArray [line 667]

The marshallFieldArray( result $result, [closeResultSet $closeResultSet = true], [assocKey $assocKey = ''], [ $clean = true])

Transform a result set into an array of field values



Tags:

return:  resulting field array


Parameters:

result   $result   The result set we wish to marshall
closeResultSet   $closeResultSet   whether or not to close the supplied result set (optional) (default=true)
assocKey   $assocKey   The key field to use to build the associative index (optional) (default='')
   $clean  

[ Top ]

method marshallObjects [line 500]

The marshallObjects( result $result, objectColumns $objectColumns, [closeResultSet $closeResultSet = true], [assocKey $assocKey = ''], [clean $clean = true], [permissionFilter $permissionFilter = null], [tablename $tablename = null])

Transform a SQL query result set into an object/array, optionally applying an PN permission filter



Tags:

return:  marhalled array of objects


Parameters:

result   $result   The result set we wish to marshall
objectColumns   $objectColumns   The column array to map onto the result set
closeResultSet   $closeResultSet   whether or not to close the supplied result set (optional) (default=true)
assocKey   $assocKey   The key field to use to build the associative index (optional) (default='')
clean   $clean   whether or not to clean up the fmarshalled data (optional) (default=true)
permissionFilter   $permissionFilter   The permission structure to use for permission checking (optional) (default=null)
tablename   $tablename   The tablename we're marshalling results for, used for mssql date conversion (optional) (default=null)

[ Top ]

method metaColumnNames [line 2844]

void metaColumnNames( tablename $tablename, [numericIndex $numericIndex = false])

get a list of column names in a table



Tags:

author:  Mark West


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
numericIndex   $numericIndex   use numeric keys return array of column names

[ Top ]

method metaColumns [line 2743]

void metaColumns( tablename $tablename, [notcasesensitive $assoc = false], [ $notcasesensitive = true])

get a list of columns in a table



Tags:

author:  Mark West


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
notcasesensitive   $assoc   normalize case of table name return array of column objects
   $notcasesensitive  

[ Top ]

method metaColumnType [line 2777]

void metaColumnType( tablename $tablename, column $column, [showAutoIncrement $showAutoIncrement = false], [showDefault $showDefault = false])

get a the ADODB meta-type for a table column



Tags:

author:  Robert Gasch


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
column   $column   the column we want to fetch the type for
showAutoIncrement   $showAutoIncrement   whether or not to display auto-increment information (optional) (default=false)
showDefault   $showDefault   whether or not to display default-value information (optional) (default=false) return The meta-column type (default='N', false for a non-existing column)

[ Top ]

method metaDatabases [line 2712]

void metaDatabases( )

get a list of databases available on the server



Tags:

author:  Mark West return array of databases


[ Top ]

method metaForeignKeys [line 2887]

void metaForeignKeys( tablename $tablename, [owner $owner = false], [upper $upper = false])

get a list of foreign keys for a table



Tags:

author:  Mark West
todo:  work out what owner param actually does return array of column names


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
owner   $owner  
upper   $upper   upper case key names

[ Top ]

method metaIndexes [line 2909]

void metaIndexes( table $tablename, [primary $primary = false], [owner $owner = false])

get a list of indexes for a table



Tags:

author:  Mark West
todo:  work out what owner param actually does return array of column names


Parameters:

table   $tablename   table name
primary   $primary   show only primary keys
owner   $owner  

[ Top ]

method metaPrimaryKeys [line 2865]

void metaPrimaryKeys( tablename $tablename, [owner $owner = false])

get a list of primary keys for a table



Tags:

author:  Mark West
todo:  work out what owner param actually does return array of column names


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
owner   $owner  

[ Top ]

method metaTables [line 2728]

void metaTables( [ttype $ttype = false], [showSchema $showSchema = false], [mask $mask = false])

get a list of tables in the currently connected database



Tags:

author:  Mark West


Parameters:

ttype   $ttype   type of 'tables' to get
showSchema   $showSchema   add the schema name to the table
mask   $mask   mask to apply to return result set return array of tables

[ Top ]

method objectCache [line 1287]

void &objectCache( [bool $clear = false], [string $tablename = null])

Object cache interface

Call without parameters to fetch cache. Call with $clear=true to clear the cache (optionally only for one specific table).






Parameters:

bool   $clear  
string   $tablename  

[ Top ]

method renameColumn [line 2602]

void renameColumn( tablename $tablename, oldcolumn $oldcolumn, newcolumn $newcolumn, [fields $fields = null])

rename column(s) in a table



Tags:

author:  Mark West


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
oldcolumn   $oldcolumn   The existing name of the column (full database name of column)
newcolumn   $newcolumn   The new name of the column from the pntables array
fields   $fields   field specific options (optional) (default=null) return bool

[ Top ]

method renameTable [line 2430]

bool renameTable( tablename $tablename, $newtablename)

rename database table





Parameters:

tablename   $tablename   The tablename key for the PNTables structure
   $newtablename  

[ Top ]

method selectExpandedFieldArray [line 891]

The selectExpandedFieldArray( tablename $tablename, joinInfo $joinInfo, field $field, [where $where = ''], [orderby $orderby = ''], [distinct $distinct = false], [assocKey $assocKey = ''], [permissionFilter $permissionFilter = null])

Select & return an expanded field array



Tags:

return:  resulting field array


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
joinInfo   $joinInfo   The array containing the extended join information
field   $field   The name of the field we wish to marshall
where   $where   The where clause (optional) (default='')
orderby   $orderby   The orderby clause (optional) (default='')
distinct   $distinct   whether or not to add a 'DISTINCT' clause (optional) (default=false)
assocKey   $assocKey   The key field to use to build the associative index (optional) (default='')
permissionFilter   $permissionFilter   The permission filter to use for permission checking (optional) (default=null)

[ Top ]

method selectExpandedObject [line 1399]

The selectExpandedObject( tablename $tablename, joinInfo $joinInfo, [where $where = ''], [columnArray $columnArray = null], [permissionFilter $permissionFilter = null], [categoryFilter $categoryFilter = null])

Select & return a object with it's left join fields filled in



Tags:

return:  resulting object


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
joinInfo   $joinInfo   The array containing the extended join information
where   $where   The where clause (optional)
columnArray   $columnArray   The columns to marshall into the resulting object (optional) (default=null)
permissionFilter   $permissionFilter   The permission structure to use for permission checking (optional) (default=null)
categoryFilter   $categoryFilter   The category list to use for filtering (optional) (default=null)

[ Top ]

method selectExpandedObjectArray [line 1604]

The selectExpandedObjectArray( tablename $tablename, joinInfo $joinInfo, [where $where = ''], [orderby $orderby = ''], [limitOffset $limitOffset = -1], [limitNumRows $limitNumRows = -1], [assocKey $assocKey = ''], [permissionFilter $permissionFilter = null], [columnArray $categoryFilter = null], [ $columnArray = null])

Select & return an array of objects with it's left join fields filled in



Tags:

return:  resulting object


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
joinInfo   $joinInfo   The array containing the extended join information
where   $where   The where clause (optional) (default='')
orderby   $orderby   The order by clause (optional) (default='')
limitOffset   $limitOffset   The lower limit bound (optional) (default=-1)
limitNumRows   $limitNumRows   The upper limit bound (optional) (default=-1)
assocKey   $assocKey   The key field to use to build the associative index (optional) (default='')
permissionFilter   $permissionFilter   The permission filter to use for permission checking (optional) (default=null)
columnArray   $categoryFilter   The columns to marshall into the resulting object (optional) (default=null)
   $columnArray  

[ Top ]

method selectExpandedObjectByID [line 1427]

The selectExpandedObjectByID( tablename $tablename, joinInfo $joinInfo, id $id, [field $field = 'id'], [columnArray $columnArray = null], [permissionFilter $permissionFilter = null], [categoryFilter $categoryFilter = null], [transformFunc $transformFunc = null])

Select & return an object by it's ID with it's left join fields filled in



Tags:

return:  resulting object


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
joinInfo   $joinInfo   The array containing the extended join information
id   $id   The ID value to use for object retrieval
field   $field   The field key which holds the ID value (optional) (default='id')
columnArray   $columnArray   The columns to marshall into the resulting object (optional) (default=null)
permissionFilter   $permissionFilter   The permission structure to use for permission checking (optional) (default=null)
categoryFilter   $categoryFilter   The category list to use for filtering (optional) (default=null)
transformFunc   $transformFunc   Transformation function to apply to $id (optional) (default=null)

[ Top ]

method selectExpandedObjectCount [line 1210]

The selectExpandedObjectCount( tablename $tablename, joinInfo $joinInfo, [where $where = ''], [distinct $distinct = false])

Return the number of rows affected



Tags:

return:  resulting object count


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
joinInfo   $joinInfo   The array containing the extended join information
where   $where   The where clause (optional) (default='')
distinct   $distinct   whether or not to count distinct entries (optional) (default='false')

[ Top ]

method selectField [line 1027]

The selectField( tablename $tablename, field $field, [where $where = ''])

Select & return a field



Tags:

return:  resulting field array


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
field   $field   The name of the field we wish to marshall
where   $where   The where clause (optional) (default='');

[ Top ]

method selectFieldArray [line 832]

The selectFieldArray( tablename $tablename, field $field, [where $where = ''], [orderby $orderby = ''], [distinct $distinct = false], [assocKey $assocKey = ''])

Select & return a field array



Tags:

return:  resulting field array


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
field   $field   The name of the field we wish to marshall
where   $where   The where clause (optional) (default='')
orderby   $orderby   The orderby clause (optional) (default='')
distinct   $distinct   whether or not to add a 'DISTINCT' clause (optional) (default=false)
assocKey   $assocKey   The key field to use to build the associative index (optional) (default='')

[ Top ]

method selectFieldArrayByID [line 867]

The selectFieldArrayByID( tablename $tablename, field $field, id $id, [idfield $idfield = 'id'])

Select & return an array of field by an ID-field value



Tags:

return:  resulting field value


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
field   $field   The field we wish to select
id   $id   The ID value we wish to select with
idfield   $idfield   The idfield to use (optional) (default='id');

[ Top ]

method selectFieldByID [line 1008]

The selectFieldByID( tablename $tablename, field $field, id $id, [idfield $idfield = 'id'])

Select & return a field by an ID-field value



Tags:

return:  resulting field value


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
field   $field   The field we wish to select
id   $id   The ID value we wish to select with
idfield   $idfield   The idfield to use (optional) (default='id');

[ Top ]

method selectFieldMax [line 932]

The selectFieldMax( tablename $tablename, field $field, [option $option = 'MAX'], [where $where = ''])

Select & return the max/min value of a field



Tags:

return:  resulting min/max value


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
field   $field   The name of the field we wish to marshall
option   $option   MIN, MAX, SUM or COUNT (optional) (default='MAX')
where   $where   The where clause (optional) (default='')

[ Top ]

method selectFieldMaxArray [line 968]

The selectFieldMaxArray( tablename $tablename, field $field, [option $option = 'MAX'], [where $where = ''], [assocKey $assocKey = ''])

Select & return the max/min array of a field grouped by the associated key



Tags:

return:  resulting min/max value


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
field   $field   The name of the field we wish to marshall
option   $option   MIN, MAX, SUM or COUNT (optional) (default='MAX')
where   $where   The where clause (optional) (default='')
assocKey   $assocKey   The key field to use to build the associative index (optional) (default='' which defaults to the primary key)

[ Top ]

method selectObject [line 1110]

The selectObject( tablename $tablename, [where $where = ''], [columnArray $columnArray = null], [permissionFilter $permissionFilter = null], [categoryFilter $categoryFilter = null], [ $cacheObject = true])

Select & return a specific object based on a PN table definition



Tags:

return:  resulting object


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
where   $where   The where clause (optional) (default='')
columnArray   $columnArray   The columns to marshall into the resulting object (optional) (default=null)
permissionFilter   $permissionFilter   The permission filter to use for permission checking (optional) (default=null)
categoryFilter   $categoryFilter   The category list to use for filtering (optional) (default=null)
   $cacheObject  

[ Top ]

method selectObjectArray [line 1459]

The selectObjectArray( tablename $tablename, [where $where = ''], [orderby $orderby = ''], [limitOffset $limitOffset = -1], [limitNumRows $limitNumRows = -1], [assocKey $assocKey = ''], [permissionFilter $permissionFilter = null], [categoryFilter $categoryFilter = null], [columnArray $columnArray = null])

Select & return an object array based on a PN table definition



Tags:

return:  resulting object array


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
where   $where   The where clause (optional) (default='')
orderby   $orderby   The order by clause (optional) (default='')
limitOffset   $limitOffset   The lower limit bound (optional) (default=-1)
limitNumRows   $limitNumRows   The upper limit bound (optional) (default=-1)
assocKey   $assocKey   The key field to use to build the associative index (optional) (default='')
permissionFilter   $permissionFilter   The permission filter to use for permission checking (optional) (default=null)
categoryFilter   $categoryFilter   The category list to use for filtering (optional) (default=null)
columnArray   $columnArray   The columns to marshall into the resulting object (optional) (default=null)

[ Top ]

method selectObjectArrayFilter [line 1540]

The selectObjectArrayFilter( tablename $tablename, [where $where = ''], [orderby $orderby = ''], [limitOffset $limitOffset = -1], [limitNumRows $limitNumRows = -1], [assocKey $assocKey = ''], filterCallback $filterCallback, [columnArray $categoryFilter = null], [ $columnArray = null])

Select & return an object array based on a PN table definition

The result is filtered by a callback object passed into the function. This object must have implemented a method called "checkResult" which is passed the resulting data rows one by one. The "checkResult" function returns true if the datarow is ok, otherwise it returns false.

Example:

  1.  class myFilter
  2.  {
  3.    var $userId;
  4.  
  5.    function checkResult($datarow)
  6.    {
  7.      return $datarow['ownerUserId'== $this->userId;
  8.    }
  9.  }




Tags:

return:  resulting object array


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
where   $where   The where clause (optional) (default='')
orderby   $orderby   The order by clause (optional) (default='')
limitOffset   $limitOffset   The lower limit bound (optional) (default=-1)
limitNumRows   $limitNumRows   The upper limit bound (optional) (default=-1)
assocKey   $assocKey   The key field to use to build the associative index (optional) (default='')
filterCallback   $filterCallback   The filter callback object.
columnArray   $categoryFilter   The columns to marshall into the resulting object (optional) (default=null)
   $columnArray  

[ Top ]

method selectObjectByID [line 1320]

The selectObjectByID( tablename $tablename, id $id, [field $field = 'id'], [columnArray $columnArray = null], [permissionFilter $permissionFilter = null], [categoryFilter $categoryFilter = null], [cacheObject $cacheObject = true], [transformFunc $transformFunc = null])

Select & return a specific object by using the ID field



Tags:

return:  resulting object


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
id   $id   The object ID to query
field   $field   The field key which holds the ID value (optional) (default='id')
columnArray   $columnArray   The columns to marshall into the resulting object (optional) (default=null)
permissionFilter   $permissionFilter   The permission structure to use for permission checking (optional) (default=null)
categoryFilter   $categoryFilter   The category list to use for filtering (optional) (default=null)
cacheObject   $cacheObject   If true returns a cached object if available (optional) (default=true)
transformFunc   $transformFunc   Transformation function to apply to $id (optional) (default=null)

[ Top ]

method selectObjectCount [line 1141]

The selectObjectCount( tablename $tablename, [where $where = ''], [column $column = '1'], [distinct $distinct = false], [categoryFilter $categoryFilter = null])

Return the number of rows affected



Tags:

return:  resulting object count


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
where   $where   The where clause (optional) (default='')
column   $column   The column to place in the count phrase (optional) (default='*')
distinct   $distinct   whether or not to count distinct entries (optional) (default='false')
categoryFilter   $categoryFilter   The category list to use for filtering (optional) (default=null)

[ Top ]

method selectObjectCountByID [line 1178]

The selectObjectCountByID( tablename $tablename, id $id, [field $field = 'id'], [transformFunc $transformFunc = ''])

Select an object count by ID



Tags:

return:  resulting object count


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
id   $id   The id value to match
field   $field   The field to match the ID against (optional) (default='id')
transformFunc   $transformFunc   Transformation function to apply to $id (optional) (default=null)

[ Top ]

method selectObjectSQL [line 1067]

The selectObjectSQL( sql $sql, tablename $tablename, [columnArray $columnArray = null], [permissionFilter $permissionFilter = null], [ $cacheObject = true])

Select & return a specific object using the given sql statement



Tags:

return:  resulting object


Parameters:

sql   $sql   The sql statement to execute for the selection
tablename   $tablename   The tablename key for the PNTables structure
columnArray   $columnArray   The columns to marshall into the resulting object (optional) (default=null)
permissionFilter   $permissionFilter   The permission filter to use for permission checking (optional) (default=null)
   $cacheObject  

[ Top ]

method selectObjectSum [line 1253]

The selectObjectSum( tablename $tablename, column $column, [where $where = ''], [categoryFilter $categoryFilter = null])

Return the sum of a column



Tags:

return:  resulting column sum


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
column   $column   The column to place in the sum phrase
where   $where   The where clause (optional) (default='')
categoryFilter   $categoryFilter   The category list to use for filtering (optional) (default=null)

[ Top ]

method selectScalar [line 1362]

mixed selectScalar( $sql, [ $exitOnError = true])

Execute SQL select statement and return the value of the first column in the first row

Mostly usefull for places where you want to do a "select count(*)" or similar scalar selection.




Tags:

return:  selected value


Parameters:

   $sql  
   $exitOnError  

[ Top ]

method serverInfo [line 2927]

void serverInfo( )

return server information



Tags:

author:  Mark West return array of server info


[ Top ]

method SQLCache [line 1045]

void &SQLCache( [bool $clear = false])

SQL cache interface

Call without parameters to fetch cache. Call with $clear=true to clear the cache.






Parameters:

bool   $clear  

[ Top ]

method truncateTable [line 2407]

bool truncateTable( tablename $tablename)

truncate database table





Parameters:

tablename   $tablename   The tablename key for the PNTables structure

[ Top ]

method updateObject [line 1862]

The updateObject( object The &$object, tablename $tablename, [where $where = ''], [idcolumn $idcolumn = 'id'], [force $force = false], [updateid $updateid = false])

Generate and execute an update SQL statement for the given object



Tags:

return:  result set from the update operation


Parameters:

object The   &$object   object we wish to update
tablename   $tablename   The tablename key for the PNTables structure
where   $where   The where clause (optional) (default='')
idcolumn   $idcolumn   The column which stores the primary key (optional) (default='id')
force   $force   whether or not to insert empty values as NULL (optional) (default=false)
updateid   $updateid   Allow primary key to be updated (default=false)

[ Top ]

method updateObjectArray [line 1981]

The updateObjectArray( objects &$objects, tablename $tablename, [idcolumn $idcolumn = 'id'], [force $force = false])

Loop through the array and feed it to DBUtil::updateObject()



Tags:

return:  result set from the last insert operation. The objects are updated with the newly generated ID.


Parameters:

objects   &$objects   The objectArray we wish to insert
tablename   $tablename   The tablename key for the PNTables structure
idcolumn   $idcolumn   The column which stores the primary key
force   $force   whether or not to insert empty values as NULL

[ Top ]

method _addMarshalledObjectCount [line 191]

Nothing, _addMarshalledObjectCount( count $count)

Add the specified value to the gobal object marshall counter

This function is workaround for PHP4 limitations when passing default arguments by reference




Tags:

return:  the global variable is incremented


Parameters:

count   $count   The value to add to the object marhsall counter

[ Top ]

method _checkOrderByClause [line 244]

The _checkOrderByClause( orderby $orderby, [tablename $tablename = null])

Convenience function to ensure that the order-by-clause starts with "ORDER BY"



Tags:

return:  (potenitally) altered order-by-clause


Parameters:

orderby   $orderby   The original order-by clause
tablename   $tablename   The tablename key for the PNTables structure, only used for oracle quote determination (optional) (default=null)

[ Top ]

method _checkOrderByField [line 310]

string _checkOrderByField( [field $tablename = ''], [ $field = ''])

Convenience function to ensure that the field to be used as ORDER BY is not a CLOB/BLOB when using Oracle



Tags:

return:  the order-by-clause to be used, may be ''


Parameters:

field   $tablename   The field name to be used for order by
   $field  

[ Top ]

method _checkWhereClause [line 220]

The _checkWhereClause( where $where)

Convenience function to ensure that the where-clause starts with "WHERE"



Tags:

return:  value held by the global counter


Parameters:

where   $where   The original where clause

[ Top ]

method _formatForStore [line 437]

string _formatForStore( @value $value)

Format value for use in SQL statement

Special handling for integers and booleans (the last is required for MySQL 5 strict mode)




Tags:

return:  string ready to add to SQL statement


Parameters:

@value   $value   mixed the value to format

[ Top ]

method _generateCategoryFilter [line 740]

The _generateCategoryFilter( categoryFilter $tablename, returnArray $categoryFilter, [ $returnArray = false])

Build a list of objects which are mapped to the specified categories



Tags:

return:  resulting string or array


Parameters:

categoryFilter   $tablename   The category list to use for filtering
returnArray   $categoryFilter   Whether or not to return an array (optional) (default=false)
   $returnArray  

[ Top ]

method _getAllColumns [line 372]

The _getAllColumns( tablename $tablename, [columnArray $columnArray = null])

Same as PN Api function but without AS aliasing



Tags:

return:  generated sql string


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
columnArray   $columnArray   The columns to marshall into the resulting object (optional) (default=null)

[ Top ]

method _getAllColumnsQualified [line 406]

The _getAllColumnsQualified( tablename $tablename, tablealias $tablealias, [columnArray $columnArray = null])

Same as PN Api function but returns fully qualified fieldnames



Tags:

return:  generated sql string


Parameters:

tablename   $tablename   The tablename key for the PNTables structure
tablealias   $tablealias   The SQL table alias to use in the SQL statement
columnArray   $columnArray   The columns to marshall into the resulting object (optional) (default=null)

[ Top ]

method _getFetchedObjectCount [line 157]

The _getFetchedObjectCount( )

Get the gobal object fetch counter

This function is workaround for PHP4 limitations when passing default arguments by reference




Tags:

return:  value held by the global


[ Top ]

method _getMarshalledObjectCount [line 204]