debugPrepQuery - jcobban/Genealogy GitHub Wiki

debugPrepQuery($sqlCmd, $sqlParms, $escape)

Up: class Record

This is a common global utility function used in diagnostic code in all of the classes derived from class Record. The function is defined in "Record.inc" so that it is available to all code using classes derived from class Record, but it does not depend upon any of the functionality of class Record, so there is no point in defining it as a static member function. This function takes the prepared statement string, which is passed to PDO::prepare, and the array of parameter values, which is passed to PDO::execute, and returns a string which represents a close approximation of the string that would have been passed to PDO::query and which is therefore useful in error messages.

parameter description
$sqlCmd a string containing an SQL prepared statement as passed to PDO::prepare, including insertion points.
$sqlParms an array of parameters as passed to PDO::execute to fill in the prepared statement.
$escape if this is boolean true then the return value is escaped by calling the PHP global function htmlspecialchars so that the value can be written out as part of a generated web page. If it is false the value is not escaped which is required if the value is written out as part of a JSON document. The default is true since the only place where the un-escaped value is used is in RecordSet to store the SELECT statement in the 'query' element of the information array.

The method returns a string suitable for debugging output.

It is planned to make this a method of a class derived from PDOStatement.

Next: class RecordPic