RecordSet::getWhereCommon - jcobban/Genealogy GitHub Wiki
#$recordSet->getWhereCommon($fldname, $value)
Up: class RecordSet
This is a shared utility method which generates the expression for selecting records for a column with no special characteristic. It can be called from the RecordSet::getWhere
or a class-specific implementation of method getWhere
.
The parameters for this method are:
parameter | description |
---|---|
$fldname | A string identifying the field to be used for selecting records. This may be an actual field name or a synonym defined for the table. The case of letters in the field name is ignored. |
$value | The value used for the comparison. This can be a constant. If it is an instance of Record, the comparison is to the unique key of the instance. If it is a string and the front part of the string is "length= " or "length> " then the remainder of the string is used to compare to the result of the SQL length function. If it is a string and the front part of the string is one of the following comparison operators, <=, <, =,!=, <=>, <>, >, >=, IS, IS NOT, then the operator is used for the comparison, otherwise comparison is for equality. If it is a string and the front part of the string is '&' then the value is a bit mask to be tested for non-zero by ($fldname&$value)!=0 . If the value is an array then each element is handled as described for an elementary value. If all of the array elements are compared for equal then the resulting expression will match if any of the values match, otherwise all of the comparisons must match. If the value is an array containing two values the first of which is a simple value and the second is a string starting with the character ':' then the values are the bottom and top of a range. That is array($first, ":$top") is the same as array(">=$first","<=$top") . |
This returns a string containing a fragment of an SQL expression that can be substituted into a MySQL WHERE clause