summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--framework/Data/Common/Oracle/TOracleCommandBuilder.php41
2 files changed, 16 insertions, 26 deletions
diff --git a/HISTORY b/HISTORY
index 6b20829f..7dac8fd2 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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 8c60751a..a22c0f08 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;
}