]> granicus.if.org Git - php/commitdiff
- Fixed bug #50162 (Memory leak when fetching timestamp column from Oracle database)
authorFelipe Pena <felipe@php.net>
Sun, 6 Dec 2009 18:53:16 +0000 (18:53 +0000)
committerFelipe Pena <felipe@php.net>
Sun, 6 Dec 2009 18:53:16 +0000 (18:53 +0000)
- Fixed bug #34852 (Failure in odbc_exec() using oracle-supplied odbc driver) (patch by tim dot tassonis at trivadis dot com)

NEWS
ext/odbc/php_odbc.c

diff --git a/NEWS b/NEWS
index 612b4cc3b33815091ace816f8194e7e971f97eea..4370736e445850a5a7747436f00989ef6349f411 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,12 +13,16 @@ PHP                                                                        NEWS
 - Fixed bug #50266 (conflicting types for llabs). (Jani)
 - Fixed bug #50168 (FastCGI fails with wrong error on HEAD request to
   non-existent file). (Dmitry)
+- Fixed bug #50162 (Memory leak when fetching timestamp column from Oracle
+  database). (Felipe)
 - Fixed bug #49660 (libxml 2.7.3+ limits text nodes to 10MB). (Felipe)
 - Fixed bug #49472 (Constants defined in Interfaces can be overridden).
   (Felipe)
 - Fixed bug #47848 (importNode doesn't preserve attribute namespaces). (Rob)
 - Fixed bug #45120 (PDOStatement->execute() returns true then false for same
   statement). (Pierrick)
+- Fixed bug #34852 (Failure in odbc_exec() using oracle-supplied odbc
+  driver). (tim dot tassonis at trivadis dot com)
 
 
 27 Nov 2009, PHP 5.2.12RC3
index b7f2c26c41c99f7b2ce74a1417463897e830e8a1..00e3b72bd2705e0a6f21cd0b0d5089d65b335267 100644 (file)
@@ -725,6 +725,10 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
                                                                        NULL, 0, NULL, &displaysize);
                                displaysize = displaysize <= result->longreadlen ? displaysize : 
                                                                result->longreadlen;
+                               /* Workaround for Oracle ODBC Driver bug (#50162) when fetching TIMESTAMP column */
+                               if (result->values[i].coltype == SQL_TIMESTAMP) {
+                                       displaysize += 3;
+                               }
                                result->values[i].value = (char *)emalloc(displaysize + 1);
                                rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value,
                                                        displaysize + 1, &result->values[i].vallen);
@@ -925,13 +929,7 @@ PHP_FUNCTION(odbc_prepare)
                        /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
                           type if not possible.
                        */
-                       int cursortype = ODBCG(default_cursortype);
-                       if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) {
-                               odbc_sql_error(conn, result->stmt, " SQLSetStmtOption");
-                               SQLFreeStmt(result->stmt, SQL_DROP);
-                               efree(result);
-                               RETURN_FALSE;
-                       }
+                       SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype));
                }
        } else {
                result->fetch_abs = 0;
@@ -1346,13 +1344,7 @@ PHP_FUNCTION(odbc_exec)
                        /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
                           type if not possible.
                         */
-                       int cursortype = ODBCG(default_cursortype);
-                       if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) {
-                               odbc_sql_error(conn, result->stmt, " SQLSetStmtOption");
-                               SQLFreeStmt(result->stmt, SQL_DROP);
-                               efree(result);
-                               RETURN_FALSE;
-                       }
+                       SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, ODBCG(default_cursortype));
                }
        } else {
                result->fetch_abs = 0;