[ class tree: DB ] [ index: DB ] [ all elements ]

Class: DB_storage

Source Location: /DB-1.8.2/DB/storage.php

Class Overview


Provides an object interface to a table row



  • Release: 1.8.2


  • 1997-2007 The PHP Group


Inherited Variables

Inherited Methods

Class Details

[line 44]
Provides an object interface to a table row

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

[ Top ]

Method Detail

DB_storage (Constructor)   [line 97]

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

[ Top ]

_DB_storage (Destructor)   [line 428]

void _DB_storage( )

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

[ Top ]

create   [line 293]

object a &create( $data $table, &$data)

Static method used to create new DB storage objects.
  • Return: new instance of DB_storage or a subclass of it


$data   $table     assoc. array where the keys are the names of properties/columns

[ Top ]

dump   [line 275]

void dump( )

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

[ Top ]

get   [line 411]

attribute &get( string $property)

Fetch an attribute value.
  • Return: contents, or null if the attribute name is unknown


string   $property     attribute name

[ Top ]

insert   [line 197]

void insert( $newpk)

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



[ Top ]

remove   [line 476]

mixed remove( )

Remove the row represented by this object from the database.
  • Return: DB_OK or a DB error

[ Top ]

set   [line 362]

void set( $property, $newvalue)

Modify an attriute value.



[ Top ]

setup   [line 167]

int setup( $keyval $keyval)

Method used to initialize a DB_storage object from the configured table.
  • Return: DB_OK on success, a DB error if not


$keyval   $keyval     mixed the key[s] of the row to fetch (string or array)

[ Top ]

store   [line 446]

DB_OK store( )

Stores changes to this object in the database.
  • Return: or a DB error

[ Top ]

toString   [line 228]

string toString( )

Output a simple description of this DB_storage object.
  • Return: object description

[ Top ]

Documentation generated on Thu, 27 Nov 2014 17:30:21 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.