Andrew's Web Libraries (AWL)
DBRecord Class Reference
Inheritance diagram for DBRecord:

Public Member Functions

 __construct ()
 
 Initialise ( $table, $keys=array())
 
 AddTable ( $table, $target_list, $join_clause, $and_where)
 
 PostToValues ( $prefix="")
 
 _BuildJoinClause ()
 
 _BuildFieldList ()
 
 _BuildWhereClause ($overwrite_values=false)
 
 Set ($fname, $fval)
 
 Get ($fname)
 
 Undefine ($fname)
 
 Write ()
 
 Read ()
 

Public Attributes

 $Table
 
 $Fields
 
 $Keys
 
 $Values
 
 $WriteType
 
 $OtherTable
 
 $OtherTargets
 
 $OtherJoin
 
 $OtherWhere
 
 $EditMode
 

Detailed Description

Definition at line 122 of file DataUpdate.php.

Constructor & Destructor Documentation

◆ __construct()

DBRecord::__construct ( )

#- Really numbingly simple construction.

Definition at line 202 of file DataUpdate.php.

Member Function Documentation

◆ _BuildFieldList()

DBRecord::_BuildFieldList ( )

Builds a field target list

Returns
string A simple SQL target field list for each field, possibly including prefixes.

Definition at line 274 of file DataUpdate.php.

◆ _BuildJoinClause()

DBRecord::_BuildJoinClause ( )

Builds a table join clause

Returns
string A simple SQL target join clause excluding the primary table.

Definition at line 259 of file DataUpdate.php.

◆ _BuildWhereClause()

DBRecord::_BuildWhereClause (   $overwrite_values = false)

Builds a where clause to match the supplied keys

Parameters
boolean$overwrite_valuesControls whether the data values for the key fields will be forced to match the key values
Returns
string A simple SQL where clause, including the initial "WHERE", for each key / value.

Definition at line 295 of file DataUpdate.php.

◆ AddTable()

DBRecord::AddTable (   $table,
  $target_list,
  $join_clause,
  $and_where 
)

This will join an additional table to the maintained set

Parameters
string$tableThe name of the database table
array$keysAn associative array containing fieldname => value pairs for the record key.
string$joinA PostgreSQL join clause.
string$prefixA field prefix to use for these fields to distinguish them from fields in other joined tables with the same name.

Definition at line 233 of file DataUpdate.php.

◆ Get()

DBRecord::Get (   $fname)

Returns a single field from the record

Parameters
string$fnameThe name of the field to set the value for
Returns
mixed The current value of the field.

Definition at line 333 of file DataUpdate.php.

◆ Initialise()

DBRecord::Initialise (   $table,
  $keys = array() 
)

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

Parameters
string$tableThe name of the database table
array$keysAn associative array containing fieldname => value pairs for the record key.

Definition at line 217 of file DataUpdate.php.

◆ PostToValues()

DBRecord::PostToValues (   $prefix = "")

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

Definition at line 245 of file DataUpdate.php.

◆ Read()

DBRecord::Read ( )

To read the record from the database. If we don't have any keys then the record will be blank.

Returns
boolean Whether we actually read a record.

Definition at line 367 of file DataUpdate.php.

◆ Set()

DBRecord::Set (   $fname,
  $fval 
)

Sets a single field in the record

Parameters
string$fnameThe name of the field to set the value for
string$fvalThe value to set the field to
Returns
mixed The new value of the field (i.e. $fval).

Definition at line 322 of file DataUpdate.php.

◆ Undefine()

DBRecord::Undefine (   $fname)

Unsets a single field from the record

Parameters
string$fnameThe name of the field to unset the value for
Returns
mixed The current value of the field.

Definition at line 343 of file DataUpdate.php.

◆ Write()

DBRecord::Write ( )

To write the record to the database

Returns
boolean Success.

Definition at line 355 of file DataUpdate.php.


The documentation for this class was generated from the following file: