Class DB_storage

Description

Provides an object interface to a table row

It lets you add, delete and change rows using objects rather than SQL statements.

Located in /web/lib/external/pear-db/DB/storage.php (line 44)

PEAR
   |
   --DB_storage
Variable Summary
 mixed $_changes
 mixed $_dbh
 mixed $_keycolumn
 mixed $_properties
 mixed $_readonly
 mixed $_table
 mixed $_validator
Method Summary
 DB_storage DB_storage ($table $table, $keycolumn $keycolumn, $dbh &$dbh, [$validator $validator = null])
 object a &create ($data $table,  &$data)
 void dump ()
 attribute &get (string $property)
 void insert ( $newpk)
 mixed remove ()
 void set ( $property,  $newvalue)
 int setup ($keyval $keyval)
 DB_OK store ()
 string toString ()
 void _DB_storage ()
Variables
mixed $_changes = array() (line 66)

an assoc with the names of the properties in this object that

mixed $_dbh = null (line 58)

DB connection handle used for all transactions

mixed $_keycolumn = null (line 55)

which column(s) in the table contains primary keys, can be a

mixed $_properties = array() (line 62)

an assoc with the names of database fields stored as properties

mixed $_readonly = false (line 71)

flag that decides if data in this object can be changed.

mixed $_table = null (line 50)

the name of the table (or view, if the backend database supports

mixed $_validator = null (line 76)

function or method that implements a validator for fields that

Methods
Constructor DB_storage (line 97)

Constructor

DB_storage DB_storage ($table $table, $keycolumn $keycolumn, $dbh &$dbh, [$validator $validator = null])
  • $table $table: string the name of the database table
  • $keycolumn $keycolumn: mixed string with name of key column, or array of strings if the table has a primary key of more than one column
  • $dbh &$dbh: object database connection object
  • $validator $validator: mixed function or method used to validate each new value, called with three parameters: the name of the field/column that is changing, a reference to the new value and a reference to this object
create (line 293)

Static method used to create new DB storage objects.

  • return: new instance of DB_storage or a subclass of it
object a &create ($data $table,  &$data)
  • $data $table: assoc. array where the keys are the names of properties/columns
  • &$data
dump (line 275)

Dump the contents of this object to "standard output".

void dump ()
get (line 411)

Fetch an attribute value.

  • return: contents, or null if the attribute name is unknown
attribute &get (string $property)
  • string $property: attribute name
insert (line 197)

Create a new (empty) row in the configured table for this object.

void insert ( $newpk)
  • $newpk
remove (line 476)

Remove the row represented by this object from the database.

  • return: DB_OK or a DB error
mixed remove ()
set (line 362)

Modify an attriute value.

void set ( $property,  $newvalue)
  • $property
  • $newvalue
setup (line 167)

Method used to initialize a DB_storage object from the configured table.

  • return: DB_OK on success, a DB error if not
int setup ($keyval $keyval)
  • $keyval $keyval: mixed the key[s] of the row to fetch (string or array)
store (line 446)

Stores changes to this object in the database.

  • return: or a DB error
DB_OK store ()
toString (line 228)

Output a simple description of this DB_storage object.

  • return: object description
string toString ()
_DB_storage (line 428)

Destructor, calls DB_storage::store() if there are changes that are to be kept.

void _DB_storage ()

Inherited Methods

Inherited From PEAR

 PEAR::PEAR()
 PEAR::delExpect()
 PEAR::expectError()
 PEAR::getStaticProperty()
 PEAR::isError()
 PEAR::loadExtension()
 PEAR::popErrorHandling()
 PEAR::popExpect()
 PEAR::pushErrorHandling()
 PEAR::raiseError()
 PEAR::registerShutdownFunc()
 PEAR::setErrorHandling()
 PEAR::staticPopErrorHandling()
 PEAR::staticPushErrorHandling()
 PEAR::throwError()
 PEAR::_PEAR()

Documentation generated on Wed, 09 Feb 2011 09:04:47 +0700 by phpDocumentor 1.4.2