Skip to content

RecordSet::getWhereInt

James Cobban edited this page Dec 14, 2019 · 8 revisions

$recordSet->getWhereInt($fldname, $value)

Up: class RecordSet

This is a shared utility method which generates the expression for selecting records for columns with integer values. It can be called from the getwhere method of RecordSet or a class-specific extension of RecordSet.

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 an integer constant. If it is an instance of Record, the comparison is to the unique numeric key of the instance. 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 an integer and the second is a string consisting of the character ':' followed by an integer then the values are the bottom and top of a range. That is array($bottom, ":$top") is the same as array(">=$bottom","<=$top").

This returns a string containing a fragment of an SQL expression that can be substituted into a MySQL WHERE clause

Next: $recordset->getWherePattern($fldname, $value)

Clone this wiki locally