]> 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 83e5278e48be262dc13c22ffa66f5fb1364fa6ca..0f212f67612d139081de3a4c7794a8b36989c6aa 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -59,6 +59,8 @@ PHP                                                                        NEWS
 - Fixed bug #50174 (Incorrectly matched docComment). (Felipe)
 - Fixed bug #50168 (FastCGI fails with wrong error on HEAD request to
   non-existant file). (Dmitry)
+- Fixed bug #50162 (Memory leak when fetching timestamp column from Oracle
+  database). (Felipe)
 - Fixed bug #50159 (wrong working directory in symlinked files). (Dmitry)
 - Fixed bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses
   containing = or ?). (Pierrick)
@@ -102,7 +104,8 @@ PHP                                                                        NEWS
 - 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)
 
 19 Nov 2009, PHP 5.3.1
 - Upgraded bundled sqlite to version 3.6.19. (Scott)
index 9218245d7115492fe1e58d71d362acf384be8cb5..e8a6e9d4bb90c2c5edae727e6f190f27ba042821 100644 (file)
@@ -981,6 +981,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);
@@ -1176,13 +1180,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;
@@ -1572,13 +1570,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;