src/Data/Tools/BizRecord.php
public function getKeySearchRule($isUseOldValue = false, $isUseColumnName = false)
    {
        $keyFields = $this->getKeyFields();
        $retStr = "";
        foreach ($keyFields as $fieldName => $fieldObj) {
            if ($retStr != "")
                $retStr .= " AND ";
            $lhs = $isUseColumnName ? $fieldObj->column : "[$fieldName]";
            $rhs = $isUseOldValue ? $fieldObj->oldValue : $fieldObj->value;
            if ($rhs == "")
                $retStr .= "(" . $lhs . "='" . $rhs . "' or " . $lhs . " is null)";
            else
                $retStr .= $lhs . "='" . $rhs . "'";
        }
        return $retStr;
    }
public function getKeySearchRule($isUseOldValue = false, $isUseColumnName = false)
    {
        $keyFields = $this->getKeyFields();
        $retStr = "";
        foreach ($keyFields as $fieldName => $fieldObj) {
            if ($retStr != "")
                $retStr .= " AND ";
            $lhs = $isUseColumnName ? $fieldObj->column : "[$fieldName]";
            $rhs = $isUseOldValue ? $fieldObj->oldValue : $fieldObj->value;
            if ($rhs == "")
                $retStr .= "(" . $lhs . "='" . $rhs . "' or " . $lhs . " is null)";
            else
                $retStr .= $lhs . "='" . $rhs . "'";
        }
        return $retStr;
    }
Get key search rule.
The key search rule is used to find a single record by given key values

@param boolean $isUseOldValue true if old key value is used in the search rule
@param boolean $isUseColumnName true if column name is used in the search rule, false if [field] is used
@return string search rule