Record::slog - jcobban/Genealogy GitHub Wiki

Record::slog($cmd, $parms, $key, $before, $after)

Up: class Record

This static method adds a record to table SqlLog which records information about a change made to the database.

Fields

The record in table SqlLog presents the following fields:

name description
'SL_Index' unique numeric key of record
'SL_DateTime' the date and time of the update
'SL_Command' the SQL command
'SL_Parms' The parameters passed to provide substitutions into the command
'SL_ID' The primary key of the updated record
'SL_UserName' the user identifier of the requesting user
'SL_OldJson' the contents of the record before update, expressed in JSON syntax
'SL_NewJson' the contents of the record after update, expressed in JSON syntax

These records contain a before and after image of the record that can be used either to apply changes to another copy of the system, or to back-out changes. For changes made to a single record the method $record->log should be used, but this method can be used to record changes that apply to multiple records, such as those made by $recordSet->update or $recordSet->delete.

parameter description
$cmd The SQL command issued to update the database as passed to either PDO::prepare or PDO::query.
$parms This contains an array of substitution values as passed to PDOStatement::execute. It is null if PDO::query is used
$key Where the record has a unique integer key this reflects the key value. The methods $recordSet->update and $recordSet->delete put the count of the number of records changed in this field.
$before a string containing a JSON representation of the record contents before applying the change.
$after a string containing a JSON representation of the record contents after applying the command.

Next: Record::getRealFieldName($fldname)