diff options
author | Christophe.Boulain <> | 2009-05-11 08:48:37 +0000 |
---|---|---|
committer | Christophe.Boulain <> | 2009-05-11 08:48:37 +0000 |
commit | 0269b09a498c0d5c98ba4cd9690827f65bb2d1b4 (patch) | |
tree | 912ddf16509bd08c49097c023f56447fe5cae1a7 | |
parent | f18f3e606b2c1b8e7de3def314b79bb7f2c69830 (diff) |
Fixed Issue#148
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | framework/Data/Common/Oracle/TOracleCommandBuilder.php | 41 |
2 files changed, 16 insertions, 26 deletions
@@ -14,6 +14,7 @@ BUG: Issue#127 - TDataSourceConfig::findConnectionByID try to access private var BUG: Issue#129 - TDbLogRoute::init don't close the sql command (Christophe) BUG: Issue#130 - TDbLogRoute::processLogs wrong values binding (Christophe) BUG: Issue#136 - TActiveDatePicker don't callback when ShowCalendar is false (Christophe) +BUG: Issue#148 - Bad Oracle Support (E.Letard) BUG: Issue#150 - Multiple TDropContainers in same namingcontainer give error (Christophe) BUG: URL wildcard patterns didn't work with subfolders BUG: TDbLogRoute::createDbTable: add AUTO_INCREMENT attribute to log_id column if driver is mysql (Yves) diff --git a/framework/Data/Common/Oracle/TOracleCommandBuilder.php b/framework/Data/Common/Oracle/TOracleCommandBuilder.php index 8c60751af..a22c0f08a 100644 --- a/framework/Data/Common/Oracle/TOracleCommandBuilder.php +++ b/framework/Data/Common/Oracle/TOracleCommandBuilder.php @@ -86,20 +86,14 @@ class TOracleCommandBuilder extends TDbCommandBuilder { $niniDoSelect = strpos($sql, 'SELECT') + 6; $nfimDoSelect = (strpos($sql, 'FROM') !== false ? strpos($sql, 'FROM') : $nfimDaSQL); - $niniDoWhere = strpos($sql, 'WHERE') + 5; - - $WhereConstraint = substr($sql, $niniDoWhere, $nfimDoWhere - $niniDoWhere); - - $WhereInSubSelect = ""; - if (trim($WhereConstraint) !== "") { - $WhereInSubSelect = "WHERE " . $WhereConstraint; - } + $WhereInSubSelect=""; + if(strpos($sql, 'WHERE')!==false) + $WhereInSubSelect = "WHERE " .substr($sql, strpos($sql, 'WHERE')+5, $nfimDoWhere - $niniDoWhere); $sORDERBY = ''; if (stripos($sql, 'ORDER') !== false) { $p = stripos($sql, 'ORDER'); - $sORDERBY = substr($sql, $p +8, 10000); - + $sORDERBY = substr($sql, $p +8); } $fields = substr($sql, 0, $nfimDoSelect); @@ -142,23 +136,18 @@ class TOracleCommandBuilder extends TDbCommandBuilder { ") WHERE {$pradoNUMLIN} >= {$offset} "; ************************* */ - $toReg = $offset + $limit -1; + $offset=(int)$offset; + $toReg = $offset + $limit ; $fullTableName = $this->getTableInfo()->getTableFullName(); - if (empty ($sORDERBY)) { - $newSql = " SELECT $fields FROM " . - "( " . - " SELECT ROW_NUMBER() OVER ( ORDER BY ROWNUM ) as {$pradoNUMLIN} {$aliasedFields} " . - " FROM {$fullTableName} {$fieldsALIAS}" . - ") nn " . - " WHERE nn.{$pradoNUMLIN} >= {$offset} AND nn.{$pradoNUMLIN} <= {$toReg} "; - } else { - $newSql = " SELECT $fields FROM " . - "( " . - " SELECT ROW_NUMBER() OVER ( ORDER BY {$sORDERBY} ) as {$pradoNUMLIN} {$aliasedFields} " . - " FROM {$fullTableName} {$fieldsALIAS} $WhereInSubSelect" . - ") nn " . - " WHERE nn.{$pradoNUMLIN} >= {$offset} AND nn.{$pradoNUMLIN} <= {$toReg} "; - } + if (empty ($sORDERBY)) + $sORDERBY="ROWNUM"; + + $newSql = " SELECT $fields FROM " . + "( " . + " SELECT ROW_NUMBER() OVER ( ORDER BY {$sORDERBY} ) -1 as {$pradoNUMLIN} {$aliasedFields} " . + " FROM {$fullTableName} {$fieldsALIAS} $WhereInSubSelect" . + ") nn " . + " WHERE nn.{$pradoNUMLIN} >= {$offset} AND nn.{$pradoNUMLIN} < {$toReg} "; //echo $newSql."\n<br>\n"; return $newSql; } |