library/Haste/Database/QueryHelper.php
public static function createWhereForSerializedBlob($strField, array $arrValues, $strCondition = self::SQL_CONDITION_OR, $blnFallback = true)
    {
        $where = null;

        if (!in_array($strCondition, [self::SQL_CONDITION_OR, self::SQL_CONDITION_AND]))
        {
            return '';
        }

        foreach ($arrValues as $val)
        {
            if ($where !== null)
            {
                $where .= " $strCondition ";
            }

            $where .= $strCondition == self::SQL_CONDITION_AND ? "(" : "";

            $where .= "$strField REGEXP (':\"" . str_replace('\'', '',$val) . "\"')";

            if ($blnFallback)
            {
                $where .= " OR $strField=" . static::escapeString($val); // backwards compatibility (if field was no array before)
            }

            $where .= $strCondition == self::SQL_CONDITION_AND ? ")" : "";
        }

        return "($where)";
    }
public static function createWhereForSerializedBlob($strField, array $arrValues, $strCondition = self::SQL_CONDITION_OR, $blnFallback = true)
    {
        $where = null;

        if (!in_array($strCondition, [self::SQL_CONDITION_OR, self::SQL_CONDITION_AND]))
        {
            return '';
        }

        foreach ($arrValues as $val)
        {
            if ($where !== null)
            {
                $where .= " $strCondition ";
            }

            $where .= $strCondition == self::SQL_CONDITION_AND ? "(" : "";

            $where .= "$strField REGEXP (':\"" . str_replace('\'', '',$val) . "\"')";

            if ($blnFallback)
            {
                $where .= " OR $strField=" . static::escapeString($val); // backwards compatibility (if field was no array before)
            }

            $where .= $strCondition == self::SQL_CONDITION_AND ? ")" : "";
        }

        return "($where)";
    }
public static function createWhereForSerializedBlob ( $ strField , array $ arrValues , $ strCondition = self :: SQL_CONDITION_OR , $ blnFallback = true ) { $ where = null ; if ( ! in_array ( $ strCondition , [ self :: SQL_CONDITION_OR , self :: SQL_CONDITION_AND ] ) ) { return '' ; } foreach ( $ arrValues as $ val ) { if ( $ where !== null ) { $ where .= " $strCondition " ; } $ where .= $ strCondition == self :: SQL_CONDITION_AND ? "(" : "" ; $ where .= "$strField REGEXP (':\"" . str_replace ( '\'' , '' , $ val ) . "\"')" ; if ( $ blnFallback ) { $ where .= " OR $strField=" . static :: escapeString ( $ val ) ; // backwards compatibility (if field was no array before) } $ where .= $ strCondition == self :: SQL_CONDITION_AND ? ")" : "" ; } return "($where)" ; }
Create a where condition for fields that contain serialized

@param string $strField     The field the condition should be checked against accordances
@param array  $arrValues    The values array to check the field against
@param string $strCondition SQL_CONDITION_OR | SQL_CONDITION_AND
@param bool   $blnFallback  Set to false if field you know the field was no array in past.

@return string
Create a where condition for fields that contain serialized