Skip to content

Commit

Permalink
Fix - PHP: Oracle with server-side processing now sorts correctly ove…
Browse files Browse the repository at this point in the history
…r the full data set
  • Loading branch information
AllanJard committed Jan 10, 2019
1 parent c784f40 commit 321bec2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Database/Driver/OracleQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,10 @@ protected function _prepare( $sql )
$sql .= ' RETURNING '.$this->_protect_identifiers(is_array($pkey) ? $pkey[0] : $pkey).' INTO :editor_pkey_value';
}
else if ( $this->_type === 'select' && $this->_oracle_offset !== null ) {
$sql = strpos($sql, 'SELECT DISTINCT') === 0 ?
str_replace('SELECT DISTINCT', 'SELECT DISTINCT rownum rn, ', $sql) :
str_replace('SELECT ', 'SELECT rownum rn, ', $sql);

$sql = '
select *
from ('.$sql.')
where rn > '.$this->_oracle_offset .' AND rn <= '.($this->_oracle_offset+$this->_oracle_limit);
where rownum > '.$this->_oracle_offset .' AND rownum <= '.($this->_oracle_offset+$this->_oracle_limit);
}

$this->database()->debugInfo( $sql, $this->_bindings );
Expand Down

0 comments on commit 321bec2

Please sign in to comment.