Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes

ADODB_Active_Record Class Reference

List of all members.

Public Member Functions

 __set ($name, $value)
 __construct ($table=false, $pkeyarr=false, $db=false)
 __wakeup ()
 _pluralize ($table)
 _singularize ($tables)
 hasMany ($foreignRef, $foreignKey=false, $foreignClass= 'ADODB_Active_Record')
 belongsTo ($foreignRef, $foreignKey=false, $parentKey='', $parentClass= 'ADODB_Active_Record')
 __get ($name)
 LoadRelations ($name, $whereOrderBy='', $offset=-1, $limit=-1)
 UpdateActiveTable ($pkeys=false, $forceUpdate=false)
 GetPrimaryKeys (&$db, $table)
 Error ($err, $fn)
 ErrorMsg ()
 ErrorNo ()
 DB ()
TableInfo ()
 Reload ()
 Set (&$row)
 LastInsertID (&$db, $fieldname)
 doquote (&$db, $val, $t)
 GenWhere (&$db, &$table)
 _QName ($n, $db=false)
 Load ($where=null, $bindarr=false)
 Reset ()
 Save ()
 Insert ()
 Delete ()
 Find ($whereOrderBy, $bindarr=false, $pkeysArr=false, $extra=array())
 Replace ()
 Update ()
 GetAttributeNames ()
 __set ($name, $value)
 __construct ($table=false, $pkeyarr=false, $db=false, $options=array())
 __wakeup ()
 _pluralize ($table)
 _singularize ($table)
 hasMany ($foreignRef, $foreignKey=false)
 belongsTo ($foreignRef, $foreignKey=false)
 __get ($name)
 LoadRelations ($name, $whereOrderBy, $offset=-1, $limit=-1)
 UpdateActiveTable ($pkeys=false, $forceUpdate=false)
 GetPrimaryKeys (&$db, $table)
 Error ($err, $fn)
 ErrorMsg ()
 ErrorNo ()
 DB ()
TableInfo ()
 Reload ()
 Set (&$row)
 LastInsertID (&$db, $fieldname)
 doquote (&$db, $val, $t)
 GenWhere (&$db, &$table)
 Load ($where=null, $bindarr=false)
 Save ()
 Dirty ()
 Insert ()
 Delete ()
 Find ($whereOrderBy, $bindarr=false, $pkeysArr=false, $extra=array())
 packageFind ($whereOrderBy, $bindarr=false, $pkeysArr=false, $extra=array())
 Replace ()
 Update ()
 GetAttributeNames ()

Static Public Member Functions

static UseDefaultValues ($bool=null)
static SetDatabaseAdapter (&$db, $index=false)
static TableHasMany ($table, $foreignRef, $foreignKey=false, $foreignClass= 'ADODB_Active_Record')
static TableKeyHasMany ($table, $tablePKey, $foreignRef, $foreignKey=false, $foreignClass= 'ADODB_Active_Record')
static ClassHasMany ($parentclass, $foreignRef, $foreignKey=false, $foreignClass= 'ADODB_Active_Record')
static ClassBelongsTo ($class, $foreignRef, $foreignKey=false, $parentKey='', $parentClass= 'ADODB_Active_Record')
static TableBelongsTo ($table, $foreignRef, $foreignKey=false, $parentKey='', $parentClass= 'ADODB_Active_Record')
static TableKeyBelongsTo ($table, $tablePKey, $foreignRef, $foreignKey=false, $parentKey='', $parentClass= 'ADODB_Active_Record')
static UseDefaultValues ($bool=null)
static SetDatabaseAdapter (&$db)

Public Attributes

 $_dbat
 $_table
 $_tableat
 $_where
 $_saved = false
 $_lasterr = false
 $_original = false
 $foreignName
 $_sTable
 $_pTable

Static Public Attributes

static $_changeNames = true
static $_quoteNames = false
static $_foreignSuffix = '_id'
static $IrregularP
static $IrregularS
static $WeIsI

Detailed Description

Definition at line 75 of file adodb-active-record.inc.php.


Constructor & Destructor Documentation

ADODB_Active_Record::__construct ( table = false,
pkeyarr = false,
db = false 
)

Definition at line 111 of file adodb-active-record.inc.php.

References $_ADODB_ACTIVE_DBS, _pluralize(), Error(), SetDatabaseAdapter(), and UpdateActiveTable().

Here is the call graph for this function:

ADODB_Active_Record::__construct ( table = false,
pkeyarr = false,
db = false,
options = array() 
)

Definition at line 131 of file adodb-active-recordx.inc.php.

References $_ADODB_ACTIVE_DBS, _pluralize(), _singularize(), Error(), SetDatabaseAdapter(), TableInfo(), and UpdateActiveTable().

Here is the call graph for this function:


Member Function Documentation

ADODB_Active_Record::__get ( name  ) 

__get Access properties - used for lazy loading

Parameters:
mixed $name protected
Returns:
mixed

Definition at line 274 of file adodb-active-record.inc.php.

References LoadRelations().

Here is the call graph for this function:

ADODB_Active_Record::__get ( name  ) 

__get Access properties - used for lazy loading

Parameters:
mixed $name protected
Returns:
void

Definition at line 340 of file adodb-active-recordx.inc.php.

References LoadRelations().

Here is the call graph for this function:

ADODB_Active_Record::__set ( name,
value 
)

Definition at line 115 of file adodb-active-recordx.inc.php.

References $value.

ADODB_Active_Record::__set ( name,
value 
)

Definition at line 104 of file adodb-active-record.inc.php.

References $value.

ADODB_Active_Record::__wakeup (  ) 

Definition at line 182 of file adodb-active-recordx.inc.php.

ADODB_Active_Record::__wakeup (  ) 

Definition at line 139 of file adodb-active-record.inc.php.

ADODB_Active_Record::_pluralize ( table  ) 

Definition at line 145 of file adodb-active-record.inc.php.

References $_changeNames.

Referenced by __construct(), and belongsTo().

Here is the caller graph for this function:

ADODB_Active_Record::_pluralize ( table  ) 

Definition at line 216 of file adodb-active-recordx.inc.php.

References $_changeNames.

ADODB_Active_Record::_QName ( n,
db = false 
)

Definition at line 671 of file adodb-active-record.inc.php.

References $_quoteNames, and DB().

Referenced by Insert(), and Update().

Here is the call graph for this function:

Here is the caller graph for this function:

ADODB_Active_Record::_singularize ( table  ) 

Definition at line 249 of file adodb-active-recordx.inc.php.

References $_changeNames.

ADODB_Active_Record::_singularize ( tables  ) 

Definition at line 170 of file adodb-active-record.inc.php.

References $_changeNames.

Referenced by __construct().

Here is the caller graph for this function:

ADODB_Active_Record::belongsTo ( foreignRef,
foreignKey = false,
parentKey = '',
parentClass = 'ADODB_Active_Record' 
)

Definition at line 232 of file adodb-active-record.inc.php.

References _pluralize().

Here is the call graph for this function:

ADODB_Active_Record::belongsTo ( foreignRef,
foreignKey = false 
)

ar->foreignName will contain the name of the tables associated with this table because this table's rows may also be referenced by those tables using thistable_id or the provided foreign keys (this index name is stored in ar->foreignKey)

this-table.other-table_id = other-table.id

Definition at line 315 of file adodb-active-recordx.inc.php.

References _pluralize().

Here is the call graph for this function:

static ADODB_Active_Record::ClassBelongsTo ( class,
foreignRef,
foreignKey = false,
parentKey = '',
parentClass = 'ADODB_Active_Record' 
) [static]

Definition at line 247 of file adodb-active-record.inc.php.

static ADODB_Active_Record::ClassHasMany ( parentclass,
foreignRef,
foreignKey = false,
foreignClass = 'ADODB_Active_Record' 
) [static]

Definition at line 225 of file adodb-active-record.inc.php.

ADODB_Active_Record::DB (  ) 

Definition at line 531 of file adodb-active-record.inc.php.

References $_ADODB_ACTIVE_DBS, and Error().

Referenced by _QName(), Delete(), ErrorMsg(), ErrorNo(), Find(), Insert(), Load(), LoadRelations(), packageFind(), Reload(), Replace(), Set(), and Update().

Here is the call graph for this function:

Here is the caller graph for this function:

ADODB_Active_Record::DB (  ) 

Definition at line 583 of file adodb-active-recordx.inc.php.

References $_ADODB_ACTIVE_DBS, and Error().

Here is the call graph for this function:

ADODB_Active_Record::Delete (  ) 

Definition at line 783 of file adodb-active-record.inc.php.

References $sql, DB(), GenWhere(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Delete (  ) 

Definition at line 949 of file adodb-active-recordx.inc.php.

References $sql, DB(), GenWhere(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Dirty (  ) 

Definition at line 893 of file adodb-active-recordx.inc.php.

ADODB_Active_Record::doquote ( &$  db,
val,
t 
)

Definition at line 629 of file adodb-active-record.inc.php.

Referenced by GenWhere(), and Replace().

Here is the caller graph for this function:

ADODB_Active_Record::doquote ( &$  db,
val,
t 
)

Definition at line 707 of file adodb-active-recordx.inc.php.

ADODB_Active_Record::Error ( err,
fn 
)

Definition at line 487 of file adodb-active-record.inc.php.

References $_ADODB_ACTIVE_DBS, and adodb_throw().

Referenced by __construct(), DB(), Set(), Update(), and UpdateActiveTable().

Here is the call graph for this function:

Here is the caller graph for this function:

ADODB_Active_Record::Error ( err,
fn 
)

Definition at line 539 of file adodb-active-recordx.inc.php.

References $_ADODB_ACTIVE_DBS, and adodb_throw().

Here is the call graph for this function:

ADODB_Active_Record::ErrorMsg (  ) 

Definition at line 509 of file adodb-active-record.inc.php.

References DB().

Here is the call graph for this function:

ADODB_Active_Record::ErrorMsg (  ) 

Definition at line 561 of file adodb-active-recordx.inc.php.

References DB().

Here is the call graph for this function:

ADODB_Active_Record::ErrorNo (  ) 

Definition at line 521 of file adodb-active-record.inc.php.

References DB().

Here is the call graph for this function:

ADODB_Active_Record::ErrorNo (  ) 

Definition at line 573 of file adodb-active-recordx.inc.php.

References DB().

Here is the call graph for this function:

ADODB_Active_Record::Find ( whereOrderBy,
bindarr = false,
pkeysArr = false,
extra = array() 
)

Definition at line 962 of file adodb-active-recordx.inc.php.

References DB(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Find ( whereOrderBy,
bindarr = false,
pkeysArr = false,
extra = array() 
)

Definition at line 796 of file adodb-active-record.inc.php.

References DB().

Here is the call graph for this function:

ADODB_Active_Record::GenWhere ( &$  db,
&$  table 
)

Definition at line 656 of file adodb-active-record.inc.php.

References doquote().

Referenced by Delete(), Reload(), and Update().

Here is the call graph for this function:

Here is the caller graph for this function:

ADODB_Active_Record::GenWhere ( &$  db,
&$  table 
)

Definition at line 730 of file adodb-active-recordx.inc.php.

References doquote().

Here is the call graph for this function:

ADODB_Active_Record::GetAttributeNames (  ) 

Definition at line 1101 of file adodb-active-recordx.inc.php.

References TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::GetAttributeNames (  ) 

Definition at line 922 of file adodb-active-record.inc.php.

References TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::GetPrimaryKeys ( &$  db,
table 
)

Definition at line 481 of file adodb-active-record.inc.php.

Referenced by UpdateActiveTable().

Here is the caller graph for this function:

ADODB_Active_Record::GetPrimaryKeys ( &$  db,
table 
)

Definition at line 533 of file adodb-active-recordx.inc.php.

ADODB_Active_Record::hasMany ( foreignRef,
foreignKey = false 
)

Definition at line 291 of file adodb-active-recordx.inc.php.

References TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::hasMany ( foreignRef,
foreignKey = false,
foreignClass = 'ADODB_Active_Record' 
)

Definition at line 196 of file adodb-active-record.inc.php.

ADODB_Active_Record::Insert (  ) 

Definition at line 899 of file adodb-active-recordx.inc.php.

References $sql, DB(), LastInsertID(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Insert (  ) 

Definition at line 733 of file adodb-active-record.inc.php.

References $sql, _QName(), DB(), LastInsertID(), and TableInfo().

Referenced by Save().

Here is the call graph for this function:

Here is the caller graph for this function:

ADODB_Active_Record::LastInsertID ( &$  db,
fieldname 
)

Definition at line 692 of file adodb-active-recordx.inc.php.

ADODB_Active_Record::LastInsertID ( &$  db,
fieldname 
)

Definition at line 614 of file adodb-active-record.inc.php.

Referenced by Insert(), and Replace().

Here is the caller graph for this function:

ADODB_Active_Record::Load ( where = null,
bindarr = false 
)

Todo:
Improve by storing once and for all in table metadata
Todo:
Also re-use info for hasManyId

Definition at line 747 of file adodb-active-recordx.inc.php.

References $foreignName, $row, DB(), Set(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Load ( where = null,
bindarr = false 
)

Definition at line 680 of file adodb-active-record.inc.php.

References $row, DB(), and Set().

Referenced by Reload().

Here is the call graph for this function:

Here is the caller graph for this function:

ADODB_Active_Record::LoadRelations ( name,
whereOrderBy = '',
offset = -1,
limit = -1 
)
Parameters:
string $name
string $whereOrderBy : eg. ' AND field1 = value ORDER BY field2'
offset 
limit 
Returns:
mixed

Definition at line 286 of file adodb-active-record.inc.php.

References DB(), and TableInfo().

Referenced by __get().

Here is the call graph for this function:

Here is the caller graph for this function:

ADODB_Active_Record::LoadRelations ( name,
whereOrderBy,
offset = -1,
limit = -1 
)

Definition at line 345 of file adodb-active-recordx.inc.php.

References TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::packageFind ( whereOrderBy,
bindarr = false,
pkeysArr = false,
extra = array() 
)

Definition at line 975 of file adodb-active-recordx.inc.php.

References DB(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Reload (  ) 

Definition at line 557 of file adodb-active-record.inc.php.

References DB(), GenWhere(), Load(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Reload (  ) 

Definition at line 610 of file adodb-active-recordx.inc.php.

References DB(), GenWhere(), Load(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Replace (  ) 

Definition at line 985 of file adodb-active-recordx.inc.php.

References DB(), doquote(), LastInsertID(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Replace (  ) 

Definition at line 804 of file adodb-active-record.inc.php.

References DB(), doquote(), LastInsertID(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Reset (  ) 

Definition at line 706 of file adodb-active-record.inc.php.

ADODB_Active_Record::Save (  ) 

Definition at line 723 of file adodb-active-record.inc.php.

References Insert(), and Update().

Here is the call graph for this function:

ADODB_Active_Record::Save (  ) 

Definition at line 883 of file adodb-active-recordx.inc.php.

References Insert(), and Update().

Here is the call graph for this function:

ADODB_Active_Record::Set ( &$  row  ) 

Definition at line 620 of file adodb-active-recordx.inc.php.

References $ACTIVE_RECORD_SAFETY, $row, $value, DB(), Error(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Set ( &$  row  ) 

Definition at line 567 of file adodb-active-record.inc.php.

References $ACTIVE_RECORD_SAFETY, $row, $value, DB(), Error(), and TableInfo().

Referenced by Load().

Here is the call graph for this function:

Here is the caller graph for this function:

static ADODB_Active_Record::SetDatabaseAdapter ( &$  db,
index = false 
) [static]

Definition at line 98 of file adodb-active-record.inc.php.

References ADODB_SetDatabaseAdapter().

Referenced by __construct().

Here is the call graph for this function:

Here is the caller graph for this function:

static ADODB_Active_Record::SetDatabaseAdapter ( &$  db  )  [static]

Definition at line 109 of file adodb-active-recordx.inc.php.

References ADODB_SetDatabaseAdapter().

Here is the call graph for this function:

static ADODB_Active_Record::TableBelongsTo ( table,
foreignRef,
foreignKey = false,
parentKey = '',
parentClass = 'ADODB_Active_Record' 
) [static]

Definition at line 253 of file adodb-active-record.inc.php.

static ADODB_Active_Record::TableHasMany ( table,
foreignRef,
foreignKey = false,
foreignClass = 'ADODB_Active_Record' 
) [static]

Definition at line 208 of file adodb-active-record.inc.php.

& ADODB_Active_Record::TableInfo (  ) 

Definition at line 598 of file adodb-active-recordx.inc.php.

References $_ADODB_ACTIVE_DBS.

& ADODB_Active_Record::TableInfo (  ) 

Definition at line 546 of file adodb-active-record.inc.php.

References $_ADODB_ACTIVE_DBS.

Referenced by __construct(), Delete(), Find(), GetAttributeNames(), hasMany(), Insert(), Load(), LoadRelations(), packageFind(), Reload(), Replace(), Set(), and Update().

Here is the caller graph for this function:

static ADODB_Active_Record::TableKeyBelongsTo ( table,
tablePKey,
foreignRef,
foreignKey = false,
parentKey = '',
parentClass = 'ADODB_Active_Record' 
) [static]

Definition at line 259 of file adodb-active-record.inc.php.

static ADODB_Active_Record::TableKeyHasMany ( table,
tablePKey,
foreignRef,
foreignKey = false,
foreignClass = 'ADODB_Active_Record' 
) [static]

Definition at line 215 of file adodb-active-record.inc.php.

ADODB_Active_Record::Update (  ) 

Definition at line 1047 of file adodb-active-recordx.inc.php.

References $pairs, $sql, DB(), Error(), GenWhere(), and TableInfo().

Here is the call graph for this function:

ADODB_Active_Record::Update (  ) 

Definition at line 869 of file adodb-active-record.inc.php.

References $pairs, $sql, _QName(), DB(), Error(), GenWhere(), and TableInfo().

Referenced by Save().

Here is the call graph for this function:

Here is the caller graph for this function:

ADODB_Active_Record::UpdateActiveTable ( pkeys = false,
forceUpdate = false 
)

Definition at line 336 of file adodb-active-record.inc.php.

References $_ADODB_ACTIVE_DBS, $ADODB_ACTIVE_CACHESECS, $ADODB_ACTIVE_DEFVALS, adodb_write_file(), Error(), and GetPrimaryKeys().

Referenced by __construct().

Here is the call graph for this function:

Here is the caller graph for this function:

ADODB_Active_Record::UpdateActiveTable ( pkeys = false,
forceUpdate = false 
)

Definition at line 394 of file adodb-active-recordx.inc.php.

References $_ADODB_ACTIVE_DBS, $ADODB_ACTIVE_CACHESECS, $ADODB_ACTIVE_DEFVALS, adodb_write_file(), Error(), and GetPrimaryKeys().

Here is the call graph for this function:

static ADODB_Active_Record::UseDefaultValues ( bool = null  )  [static]

Definition at line 101 of file adodb-active-recordx.inc.php.

References $ADODB_ACTIVE_DEFVALS.

static ADODB_Active_Record::UseDefaultValues ( bool = null  )  [static]

Definition at line 90 of file adodb-active-record.inc.php.

References $ADODB_ACTIVE_DEFVALS.


Member Data Documentation

static ADODB_Active_Record::$_changeNames = true [static]

Definition at line 76 of file adodb-active-record.inc.php.

Referenced by _pluralize(), and _singularize().

ADODB_Active_Record::$_dbat

Definition at line 80 of file adodb-active-record.inc.php.

static ADODB_Active_Record::$_foreignSuffix = '_id' [static]

Definition at line 79 of file adodb-active-record.inc.php.

ADODB_Active_Record::$_lasterr = false

Definition at line 85 of file adodb-active-record.inc.php.

ADODB_Active_Record::$_original = false

Definition at line 86 of file adodb-active-record.inc.php.

ADODB_Active_Record::$_pTable

Definition at line 92 of file adodb-active-recordx.inc.php.

ADODB_Active_Record::$_quoteNames = false [static]

Definition at line 77 of file adodb-active-record.inc.php.

Referenced by _QName().

ADODB_Active_Record::$_saved = false

Definition at line 84 of file adodb-active-record.inc.php.

ADODB_Active_Record::$_sTable

Definition at line 91 of file adodb-active-recordx.inc.php.

ADODB_Active_Record::$_table

Definition at line 81 of file adodb-active-record.inc.php.

ADODB_Active_Record::$_tableat

Definition at line 82 of file adodb-active-record.inc.php.

ADODB_Active_Record::$_where

Definition at line 83 of file adodb-active-record.inc.php.

ADODB_Active_Record::$foreignName

Definition at line 88 of file adodb-active-record.inc.php.

Referenced by Load().

ADODB_Active_Record::$IrregularP [static]
Initial value:
 array(
                'PERSON'    => 'people',
                'MAN'       => 'men',
                'WOMAN'     => 'women',
                'CHILD'     => 'children',
                'COW'       => 'kine',
        )

Definition at line 189 of file adodb-active-recordx.inc.php.

ADODB_Active_Record::$IrregularS [static]
Initial value:
 array(
                'PEOPLE'    => 'PERSON',
                'MEN'       => 'man',
                'WOMEN'     => 'woman',
                'CHILDREN'  => 'child',
                'KINE'      => 'cow',
        )

Definition at line 197 of file adodb-active-recordx.inc.php.

ADODB_Active_Record::$WeIsI [static]
Initial value:
 array(
                'EQUIPMENT' => true,
                'INFORMATION'   => true,
                'RICE'      => true,
                'MONEY'     => true,
                'SPECIES'   => true,
                'SERIES'    => true,
                'FISH'      => true,
                'SHEEP'     => true,
        )

Definition at line 205 of file adodb-active-recordx.inc.php.


The documentation for this class was generated from the following files: