Class DBRecord

Description

A Base class to use for records which will be read/written from the database.

Located in /DataUpdate.php (line 120)


	
			
Direct descendents
Class Description
 class User A class to handle reading, writing, viewing, editing and validating usr records.
Variable Summary
 object $EditMode
Method Summary
 DBRecord DBRecord ()
 void AddTable (string $table,  $target_list,  $join_clause,  $and_where, array $keys, string $join, string $prefix)
 mixed Get (string $fname)
 void Initialise (string $table, [array $keys = array()])
 void PostToValues ([ $prefix = ""])
 boolean Read ()
 mixed Set (string $fname, string $fval)
 mixed Undefine (string $fname)
 boolean Write ()
 string _BuildFieldList ()
 string _BuildJoinClause ()
 string _BuildWhereClause ([boolean $overwrite_values = false])
Variables
object $EditMode (line 193)

The mode we are in for any form

  • access: public
Methods
Constructor DBRecord (line 200)

Really numbingly simple construction.

DBRecord DBRecord ()
AddTable (line 231)

This will join an additional table to the maintained set

void AddTable (string $table,  $target_list,  $join_clause,  $and_where, array $keys, string $join, string $prefix)
  • string $table: The name of the database table
  • array $keys: An associative array containing fieldname => value pairs for the record key.
  • string $join: A PostgreSQL join clause.
  • string $prefix: A field prefix to use for these fields to distinguish them from fields in other joined tables with the same name.
  • $target_list
  • $join_clause
  • $and_where
Get (line 331)

Returns a single field from the record

  • return: The current value of the field.
mixed Get (string $fname)
  • string $fname: The name of the field to set the value for
Initialise (line 215)

This will read the record from the database if it's available, and the $keys parameter is a non-empty array.

void Initialise (string $table, [array $keys = array()])
  • string $table: The name of the database table
  • array $keys: An associative array containing fieldname => value pairs for the record key.
PostToValues (line 243)

This will assign $_POST values to the internal Values object for each field that exists in the Fields array.

void PostToValues ([ $prefix = ""])
  • $prefix
Read (line 365)

To read the record from the database.

If we don't have any keys then the record will be blank.

  • return: Whether we actually read a record.
boolean Read ()
Set (line 320)

Sets a single field in the record

  • return: The new value of the field (i.e. $fval).
mixed Set (string $fname, string $fval)
  • string $fname: The name of the field to set the value for
  • string $fval: The value to set the field to
Undefine (line 341)

Unsets a single field from the record

  • return: The current value of the field.
mixed Undefine (string $fname)
  • string $fname: The name of the field to unset the value for
Write (line 353)

To write the record to the database

  • return: Success.
boolean Write ()

Redefined in descendants as:
_BuildFieldList (line 272)

Builds a field target list

  • return: A simple SQL target field list for each field, possibly including prefixes.
string _BuildFieldList ()
_BuildJoinClause (line 257)

Builds a table join clause

  • return: A simple SQL target join clause excluding the primary table.
string _BuildJoinClause ()
_BuildWhereClause (line 293)

Builds a where clause to match the supplied keys

  • return: A simple SQL where clause, including the initial "WHERE", for each key / value.
string _BuildWhereClause ([boolean $overwrite_values = false])
  • boolean $overwrite_values: Controls whether the data values for the key fields will be forced to match the key values

Documentation generated on Thu, 15 Apr 2010 20:23:04 +1200 by phpDocumentor 1.3.2