[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/includes/ -> database.php (summary)

(no description)

Author: Mambo Foundation Inc see README.php
Copyright: (C) 2000 - 2009 Mambo Foundation Inc.
License: GNU/GPL Version 2, see LICENSE.php
File Size: 1136 lines (36 kb)
Included or required: 2 times
Referenced: 1 time
Includes or requires: 0 files

Defines 5 classes

database:: (42 methods):
  database()
  getCharsetFromDb()
  getCharsets()
  forceOffline()
  getNullDate()
  debug()
  debug_trace()
  getErrorNum()
  getErrorMsg()
  getEscaped()
  Quote()
  setBareQuery()
  setQuery()
  replacePrefix()
  getQuery()
  query()
  query_batch()
  explain()
  getNumRows()
  getAffectedRows()
  retrieveResults()
  loadResult()
  loadResultArray()
  loadAssocList()
  mosBindArrayToObject()
  mosStripslashes()
  loadObject()
  loadObjectList()
  loadRow()
  loadRowList()
  insertObject()
  updateObject()
  stderr()
  insertid()
  getVersion()
  GenID()
  getTableList()
  getTableCreate()
  getTableFields()
  displayLogged()
  doSQL()
  doSQLget()

mamboDatabase:: (2 methods):
  mamboDatabase()
  getInstance()

mosDBAbstractRow:: (5 methods):
  mosDBAbstractRow()
  check()
  lacks()
  move()
  updateOrder()

mosDBTable:: (16 methods):
  queryTestFailure()
  filter()
  getError()
  get()
  getPublicProperties()
  set()
  bind()
  load()
  store()
  delete()
  checkout()
  checkin()
  hit()
  save()
  publish_array()
  toXML()

mosTableEntry:: (11 methods):
  addPostData()
  forceBools()
  updateObjectDB()
  delete()
  timeStampField()
  updateSQL()
  notSQL()
  insertSQL()
  setValues()
  prepareValues()
  readDataBase()


Class: database  - X-Ref

Database connector class

database( $host='localhost', $user, $pass, $db, $table_prefix )   X-Ref
Database object constructor

param: string Database host
param: string Database user name
param: string Database user password
param: string Database name
param: string Common prefix for all tables

getCharsetFromDb()   X-Ref
No description

getCharsets()   X-Ref
No description

forceOffline($error_number)   X-Ref
No description

getNullDate()   X-Ref
No description

debug( $level )   X-Ref

param: int

debug_trace()   X-Ref
No description

getErrorNum()   X-Ref

return: int The error number for the most recent query

getErrorMsg()   X-Ref

return: string The error message for the most recent query

getEscaped( $text )   X-Ref
Get a database escaped string

return: string

Quote( $text )   X-Ref
Get a quoted database escaped string

return: string

setBareQuery($sql)   X-Ref
Sets the SQL query string for later execution.

param: string The SQL query

setQuery( $sql, $prefix=')   X-Ref
Sets the SQL query string for later execution.

This function replaces a string identifier <var>$prefix</var> with the
string held is the <var>_table_prefix</var> class variable.

param: string The SQL query
param: string The common table prefix

replacePrefix($sql, $prefix=')   X-Ref
This function replaces a string identifier <var>$prefix</var> with the
string held is the <var>_table_prefix</var> class variable.

author: thede, David McKinnis
param: string The SQL query
param: string The common table prefix

getQuery($sql='')   X-Ref

return: string The current value of the internal SQL vairable

query($sql = '')   X-Ref
Execute the query

return: mixed A database resource if successful, FALSE if not.

query_batch( $abort_on_error=true, $p_transaction_safe = false)   X-Ref
No description

explain()   X-Ref
Diagnostic function


getNumRows( $cur=null )   X-Ref

return: int The number of rows returned from the most recent query - SELECT only

getAffectedRows( )   X-Ref

return: int The number of rows affected by the most recent query - INSERT, UPDATE, DELETE

retrieveResults($key='', $max=0, $result_type='row')   X-Ref
Load an array of retrieved database objects or values

param: int Database cursor
param: string The field name of a primary key
return: array If <var>key</var> is empty as sequential list of returned records.

loadResult()   X-Ref
This method loads the first field of the first row returned by the query.

return: The value returned in the query or null if the query failed.

loadResultArray($numinarray = 0)   X-Ref
Load an array of single field results into an array


loadAssocList( $key='' )   X-Ref
Load a assoc list of database rows

param: string The field name of a primary key
return: array If <var>key</var> is empty as sequential list of returned records.

mosBindArrayToObject( $array, &$obj, $ignore='', $prefix=NULL, $checkSlashes=true )   X-Ref
Copy the named array content into the object as properties
only existing properties of object are filled. when undefined in hash, properties wont be deleted

param: array the input array
param: obj byref the object to fill of any class
param: string
param: boolean

mosStripslashes(&$value)   X-Ref
Strip slashes from strings or arrays of strings

param: value the input string or array

loadObject( &$object )   X-Ref
This global function loads the first row of a query into an object

If an object is passed to this function, the returned row is bound to the existing elements of <var>object</var>.
If <var>object</var> has a value of null, then all of the returned query fields returned in the object.
param: string The SQL query
param: object The address of variable

loadObjectList( $key='' )   X-Ref
Load a list of database objects

param: string The field name of a primary key
return: array If <var>key</var> is empty as sequential list of returned records.

loadRow()   X-Ref

return: The first row of the query.

loadRowList( $key='' )   X-Ref
Load a list of database rows (numeric column indexing)

param: string The field name of a primary key
return: array If <var>key</var> is empty as sequential list of returned records.

insertObject( $table, &$object, $keyName = NULL, $verbose=false )   X-Ref
Document::db_insertObject()

{ Description }

param: [type] $keyName
param: [type] $verbose

updateObject( $table, &$object, $keyName, $updateNulls=true )   X-Ref
Document::db_updateObject()

{ Description }

param: [type] $updateNulls

stderr( $showSQL = false )   X-Ref

param: boolean If TRUE, displays the last SQL statement sent to the database
return: string A standised error message

insertid()   X-Ref
No description

getVersion()   X-Ref
No description

GenID( $foo1=null, $foo2=null )   X-Ref
Fudge method for ADOdb compatibility


getTableList()   X-Ref

return: array A list of all the tables in the database

getTableCreate( $tables )   X-Ref

param: array A list of table names
return: array A list the create SQL for the tables

getTableFields( $tables )   X-Ref

param: array A list of table names
return: array An array of fields by table

displayLogged()   X-Ref
No description

doSQL($sql)   X-Ref
No description

doSQLget($sql, $classname)   X-Ref
No description

Class: mamboDatabase  - X-Ref

mamboDatabase()   X-Ref
No description

getInstance()   X-Ref
No description

Class: mosDBAbstractRow  - X-Ref

mosDBAbstractRow Abstract Class.

mosDBAbstractRow($table='', $keyname='id', $db='')   X-Ref
Object constructor to set table and key field

Can be overloaded/supplemented by the child class
param: string $table name of the table in the db schema relating to child class
param: string $key name of the primary key field in the table

check()   X-Ref
generic check method

can be overloaded/supplemented by the child class
return: boolean True if the object is ok

lacks( $property )   X-Ref
Checks if this object lacks the property given by the parameter

param: string The name of the property
return: bool

move( $direction, $where='' )   X-Ref
No description

updateOrder( $where='', $cfid=null, $order=null )   X-Ref
Compacts the ordering sequence of the selected records

param: string Additional conditions on WHERE clause to limit ordering to a particular subset of records

Class: mosDBTable  - X-Ref

mosDBTable Abstract Class.

queryTestFailure()   X-Ref

return: bool True if DB query failed.  Sets the error message

filter( $ignoreList=null )   X-Ref
Filters public properties

param: array List of fields to ignore

getError()   X-Ref

return: string Returns the error message

get( $_property )   X-Ref
Gets the value of the class variable

param: string The name of the class variable
return: mixed The value of the class var (or null if no var of that name exists)

getPublicProperties()   X-Ref
Returns an array of public properties

return: array

set( $_property, $_value )   X-Ref
Set the value of the class variable

param: string The name of the class variable
param: mixed The value to assign to the variable

bind( $array, $ignore="" )   X-Ref
binds a named array/hash to this object

can be overloaded/supplemented by the child class
param: array $hash named array
return: null|string    null is operation was satisfactory, otherwise returns an error

load( $oid=null )   X-Ref
binds an array/hash to this object

param: int $oid optional argument, if not specifed then the value of current key is used
return: any result from the database operation

store( $updateNulls=false )   X-Ref
Inserts a new row if id is zero or updates an existing row in the database table

Can be overloaded/supplemented by the child class
param: boolean If false, null object variables are not updated
return: null|string null if successful otherwise returns and error message

delete( $oid=null )   X-Ref
Default delete method

can be overloaded/supplemented by the child class
return: true if successful otherwise returns and error message

checkout( $who, $oid=null )   X-Ref
No description

checkin( $oid=null )   X-Ref
No description

hit( $oid=null )   X-Ref
No description

save( $source, $order_filter )   X-Ref
Generic save function

returns: TRUE if completely successful, FALSE if partially or not succesful.
param: array Source array for binding to class vars
param: string Filter for the order updating

publish_array( $cid=null, $publish=1, $myid=0 )   X-Ref
Generic Publish/Unpublish function

param: array An array of id numbers
param: integer 0 if unpublishing, 1 if publishing
param: integer The id of the user performnig the operation

toXML( $mapKeysToText=false )   X-Ref
Export item list to xml

param: boolean Map foreign keys to text values

Class: mosTableEntry  - X-Ref

Abstract class for classes where the objects of the class can be relatively easily
stored in a single database table.  Can usually be adapted to more complex cases.
Requires child classes to implement: tableName(), notSQL().
tableName() must return the name of the database table, using #__ in the usual Mambo way
notSQL() must return an array of strings, where each string is the name of a
variable that is NOT in the database table, or is not written explicitly,
e.g. the auto-increment key.  If this is the ONLY non-SQL field, then the
child class need not implement it, as that it is already in the abstract class.
Child classes may implement timeStampField, in which case it must return the name
of a field that will have a timestamp placed in it whenever the DB is written.

addPostData()   X-Ref
No description

forceBools()   X-Ref
No description

updateObjectDB()   X-Ref
No description

delete()   X-Ref
No description

timeStampField()   X-Ref
No description

updateSQL()   X-Ref
No description

notSQL()   X-Ref
No description

insertSQL()   X-Ref
No description

setValues(&$anObject)   X-Ref
No description

prepareValues()   X-Ref
No description

readDataBase($sql)   X-Ref
No description