Docs For Class DBRecord

## DBRecord

Description

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

Located in /DataUpdate.php (line 121)

Direct descendents

Class | Description
--- | ---
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 194)

The mode we are in for any form

- access: public

Methods
Constructor DBRecord (line 201)

Really numbingly simple construction.

DBRecord DBRecord ()
AddTable (line 232)

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 332)

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 216)

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 244)

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 366)

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 321)

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 342)

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 354)

To write the record to the database

- return: Success.

boolean Write ()

Redefined in descendants as:

- User::Write() : Write the User record.

_BuildFieldList (line 273)

Builds a field target list

- return: A simple SQL target field list for each field, possibly including prefixes.

string _BuildFieldList ()
_BuildJoinClause (line 258)

Builds a table join clause

- return: A simple SQL target join clause excluding the primary table.

string _BuildJoinClause ()
_BuildWhereClause (line 294)

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 Fri, 13 Jan 2012 23:40:15 +1300 by phpDocumentor 1.4.3