Really numbingly simple construction.
DBRecord
DBRecord
()
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
Returns a single field from the record
mixed
Get
(string $fname)
-
string
$fname: The name of the field to set the value for
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.
This will assign $_POST values to the internal Values object for each field that exists in the Fields array.
void
PostToValues
([ $prefix = ""])
To read the record from the database.
If we don't have any keys then the record will be blank.
boolean
Read
()
Sets a single field in the record
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
Unsets a single field from the record
mixed
Undefine
(string $fname)
-
string
$fname: The name of the field to unset the value for
To write the record to the database
boolean
Write
()
Redefined in descendants as:
Builds a field target list
string
_BuildFieldList
()
Builds a table join clause
string
_BuildJoinClause
()
Builds a where clause to match the supplied keys
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