src/hathoora/grid/grid.php
public static function sqlBuildWhere($arrWhere, $whereClause = true)
    {
        $where = null;
        if (is_array($arrWhere))
        {
            if ($whereClause)
                $where = ' WHERE 1 ';
            foreach ($arrWhere as $f => $v)
            {
                if ($where)
                    $where .= ' AND ';

                $field = $f;

                // special suff?
                if (preg_match('/^(.+?):(literal|int|string)$/i', $f, $arrMatch))
                {
                    $type = array_pop($arrMatch);
                    $f =  self::getDSN()->escape(array_pop($arrMatch));

                    // literal - becareful with these!!!!
                    if ($type == 'literal')
                    {
                        // make sure this literal was not passed in the URL (GET!!)
                        if (!empty($_GET['where'][$field]))
                            unset($_GET['where'][$field]);
                        else if (!empty($_POST['where'][$field]))
                            unset($_POST['where'][$field]);
                        else
                        {
                            $where .= $v;
                        }
                    }
                    else if ($type == 'int')
                        $where .= $f .' IN ('. self::getDSN()->escape($v) .') ';
                    else if ($type == 'string')
                        $where .= $f . self::sqlWhereSmartLike($v);

                    else
                        $where .= $f .' = "'. self::getDSN()->escape($v) .'" ';
                }
                else
                    $where .= $f .' = "' . self::getDSN()->escape($v) . '" ';
            }
        }

        return $where;
    }
public static function sqlBuildWhere($arrWhere, $whereClause = true)
    {
        $where = null;
        if (is_array($arrWhere))
        {
            if ($whereClause)
                $where = ' WHERE 1 ';
            foreach ($arrWhere as $f => $v)
            {
                if ($where)
                    $where .= ' AND ';

                $field = $f;

                // special suff?
                if (preg_match('/^(.+?):(literal|int|string)$/i', $f, $arrMatch))
                {
                    $type = array_pop($arrMatch);
                    $f =  self::getDSN()->escape(array_pop($arrMatch));

                    // literal - becareful with these!!!!
                    if ($type == 'literal')
                    {
                        // make sure this literal was not passed in the URL (GET!!)
                        if (!empty($_GET['where'][$field]))
                            unset($_GET['where'][$field]);
                        else if (!empty($_POST['where'][$field]))
                            unset($_POST['where'][$field]);
                        else
                        {
                            $where .= $v;
                        }
                    }
                    else if ($type == 'int')
                        $where .= $f .' IN ('. self::getDSN()->escape($v) .') ';
                    else if ($type == 'string')
                        $where .= $f . self::sqlWhereSmartLike($v);

                    else
                        $where .= $f .' = "'. self::getDSN()->escape($v) .'" ';
                }
                else
                    $where .= $f .' = "' . self::getDSN()->escape($v) . '" ';
            }
        }

        return $where;
    }
Builds sql where criteria

@param array $arrWhere
@param bool $whereClause when true we will add where clause