protected function _buildWhere($where)
    {
        if (empty($where)) {
            return array('', array());
        }
        if (is_string($where)) {
            return array("WHERE $where", array());
        }
        $conditions = array();
        $values = array();
        foreach ($where as $key => $value) {
            if (is_array($value)) {
                $conditions[] = "$key IN(" . implode(', ', array_fill(0, count($value), '?')) . ')';
                $values = array_merge($values, $value);
            } else {
                $conditions[] = "$key = ?";
                $values[] = $value;
            }
        }
        return array(
            'WHERE ' . implode($conditions, ' AND '),
            $values
        );
    }
protected function _buildWhere($where)
    {
        if (empty($where)) {
            return array('', array());
        }
        if (is_string($where)) {
            return array("WHERE $where", array());
        }
        $conditions = array();
        $values = array();
        foreach ($where as $key => $value) {
            if (is_array($value)) {
                $conditions[] = "$key IN(" . implode(', ', array_fill(0, count($value), '?')) . ')';
                $values = array_merge($values, $value);
            } else {
                $conditions[] = "$key = ?";
                $values[] = $value;
            }
        }
        return array(
            'WHERE ' . implode($conditions, ' AND '),
            $values
        );
    }
protected function _buildWhere ( $ where ) { if ( empty ( $ where ) ) { return array ( '' , array ( ) ) ; } if ( is_string ( $ where ) ) { return array ( "WHERE $where" , array ( ) ) ; } $ conditions = array ( ) ; $ values = array ( ) ; foreach ( $ where as $ key => $ value ) { if ( is_array ( $ value ) ) { $ conditions [ ] = "$key IN(" . implode ( ', ' , array_fill ( 0 , count ( $ value ) , '?' ) ) . ')' ; $ values = array_merge ( $ values , $ value ) ; } else { $ conditions [ ] = "$key = ?" ; $ values [ ] = $ value ; } } return array ( 'WHERE ' . implode ( $ conditions , ' AND ' ) , $ values ) ; }
Builds a condition string

If $where is empty, the returned string will be empty
If $where is a string, a WHERE $where string will be returned with no params
If $where is an array, each key, value pairs will be converted to a key = value condition
and some params will be returned

@param mixed $where
@return array (query, params)
Builds a condition string