library/Garp/Model/Db.php
public function arrayToWhereClause(array $data, $and = true) {
        $out = array();
        $adapter = $this->getAdapter();
        foreach ($data as $key => $value) {
            $quotedKey = $adapter->quoteIdentifier($key);
            $quotedValue = $adapter->quote($value);

            if (is_null($value)) {
                $out[] = "$quotedKey IS NULL";
            } elseif (is_array($value)) {
                $out[] = "$quotedKey IN ($quotedValue)";
            } else {
                $out[] = "$quotedKey = $quotedValue";
            }
        }
        $glue = $and ? 'AND' : 'OR';
        $out = implode(" $glue ", $out);
        return $out;
    }
public function arrayToWhereClause(array $data, $and = true) {
        $out = array();
        $adapter = $this->getAdapter();
        foreach ($data as $key => $value) {
            $quotedKey = $adapter->quoteIdentifier($key);
            $quotedValue = $adapter->quote($value);

            if (is_null($value)) {
                $out[] = "$quotedKey IS NULL";
            } elseif (is_array($value)) {
                $out[] = "$quotedKey IN ($quotedValue)";
            } else {
                $out[] = "$quotedKey = $quotedValue";
            }
        }
        $glue = $and ? 'AND' : 'OR';
        $out = implode(" $glue ", $out);
        return $out;
    }
public function arrayToWhereClause ( array $ data , $ and = true ) { $ out = array ( ) ; $ adapter = $ this -> getAdapter ( ) ; foreach ( $ data as $ key => $ value ) { $ quotedKey = $ adapter -> quoteIdentifier ( $ key ) ; $ quotedValue = $ adapter -> quote ( $ value ) ; if ( is_null ( $ value ) ) { $ out [ ] = "$quotedKey IS NULL" ; } elseif ( is_array ( $ value ) ) { $ out [ ] = "$quotedKey IN ($quotedValue)" ; } else { $ out [ ] = "$quotedKey = $quotedValue" ; } } $ glue = $ and ? 'AND' : 'OR' ; $ out = implode ( " $glue " , $ out ) ; return $ out ; }
Convert array to WHERE clause

@param array $data
@param bool $and Wether to use AND or OR
@return string
Convert array to WHERE clause