protected function _renderOrder($sql)
    {
        if ($this->_parts[self::ORDER]) {
            $order = array();
            foreach ($this->_parts[self::ORDER] as $term) {
                if (is_array($term)) {
                    if(is_numeric($term[0]) && strval(intval($term[0])) == $term[0]) {
                        $order[] = (int)trim($term[0]) . ' ' . $term[1];
                    } else {
                        $order[] = $this->_adapter->quoteIdentifier($term[0], true) . ' ' . $term[1];
                    }
                } else if (is_numeric($term) && strval(intval($term)) == $term) {
                    $order[] = (int)trim($term);
                } else {
                    $order[] = $this->_adapter->quoteIdentifier($term, true);
                }
            }
            $sql .= ' ' . self::SQL_ORDER_BY . ' ' . implode(', ', $order);
        }

        return $sql;
    }
protected function _renderOrder($sql)
    {
        if ($this->_parts[self::ORDER]) {
            $order = array();
            foreach ($this->_parts[self::ORDER] as $term) {
                if (is_array($term)) {
                    if(is_numeric($term[0]) && strval(intval($term[0])) == $term[0]) {
                        $order[] = (int)trim($term[0]) . ' ' . $term[1];
                    } else {
                        $order[] = $this->_adapter->quoteIdentifier($term[0], true) . ' ' . $term[1];
                    }
                } else if (is_numeric($term) && strval(intval($term)) == $term) {
                    $order[] = (int)trim($term);
                } else {
                    $order[] = $this->_adapter->quoteIdentifier($term, true);
                }
            }
            $sql .= ' ' . self::SQL_ORDER_BY . ' ' . implode(', ', $order);
        }

        return $sql;
    }
protected function _renderOrder ( $ sql ) { if ( $ this -> _parts [ self :: ORDER ] ) { $ order = array ( ) ; foreach ( $ this -> _parts [ self :: ORDER ] as $ term ) { if ( is_array ( $ term ) ) { if ( is_numeric ( $ term [ 0 ] ) && strval ( intval ( $ term [ 0 ] ) ) == $ term [ 0 ] ) { $ order [ ] = ( int ) trim ( $ term [ 0 ] ) . ' ' . $ term [ 1 ] ; } else { $ order [ ] = $ this -> _adapter -> quoteIdentifier ( $ term [ 0 ] , true ) . ' ' . $ term [ 1 ] ; } } else if ( is_numeric ( $ term ) && strval ( intval ( $ term ) ) == $ term ) { $ order [ ] = ( int ) trim ( $ term ) ; } else { $ order [ ] = $ this -> _adapter -> quoteIdentifier ( $ term , true ) ; } } $ sql .= ' ' . self :: SQL_ORDER_BY . ' ' . implode ( ', ' , $ order ) ; } return $ sql ; }
Render ORDER clause

@param string   $sql SQL query
@return string
Render ORDER clause