svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/odbc/php_odbc.c branches/PHP_5_3/NEWS branches/PHP_5_3/ext/odbc/php_odbc.c
trunk/ext/odbc/php_odbc.c
| From: | Felipe Pena | Date: | Sun, 06 Dec 2009 18:53:16 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/odbc/php_odbc.c branches/PHP_5_3/NEWS branches/PHP_5_3/ext/odbc/php_odbc.c trunk/ext/odbc/php_odbc.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-61161@lists.php.net to get a copy of this message | ||
felipe Sun, 06 Dec 2009 18:53:16 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=291772
Log:
- Fixed bug #50162 (Memory leak when fetching timestamp column from Oracle database)
- Fixed bug #34852 (Failure in odbc_exec() using oracle-supplied odbc driver) (patch by tim dot
tassonis at trivadis dot com)
Bugs: http://bugs.php.net/50162 (Open) Memory leak when
fetching timestamp column from Oracle database
http://bugs.php.net/34852 (No Feedback) [PATCH]
Failure in odbc_exec() using oracle-supplied odbc driver
Changed paths:
U php/php-src/branches/PHP_5_2/NEWS
U php/php-src/branches/PHP_5_2/ext/odbc/php_odbc.c
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/odbc/php_odbc.c
U php/php-src/trunk/ext/odbc/php_odbc.c
Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS 2009-12-06 17:38:31 UTC (rev 291771)
+++ php/php-src/branches/PHP_5_2/NEWS 2009-12-06 18:53:16 UTC (rev 291772)
@@ -13,12 +13,16 @@
- 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
Modified: php/php-src/branches/PHP_5_2/ext/odbc/php_odbc.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/odbc/php_odbc.c 2009-12-06 17:38:31 UTC (rev 291771)
+++ php/php-src/branches/PHP_5_2/ext/odbc/php_odbc.c 2009-12-06 18:53:16 UTC (rev 291772)
@@ -725,6 +725,10 @@
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 @@
/* 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 @@
/* 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;
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2009-12-06 17:38:31 UTC (rev 291771)
+++ php/php-src/branches/PHP_5_3/NEWS 2009-12-06 18:53:16 UTC (rev 291772)
@@ -59,6 +59,8 @@
- 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,8 +104,9 @@
- 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)
- Updated timezone database to version 2009.17 (2009q). (Derick)
Modified: php/php-src/branches/PHP_5_3/ext/odbc/php_odbc.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/odbc/php_odbc.c 2009-12-06 17:38:31 UTC (rev 291771)
+++ php/php-src/branches/PHP_5_3/ext/odbc/php_odbc.c 2009-12-06 18:53:16 UTC (rev 291772)
@@ -981,6 +981,10 @@
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 @@
/* 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 @@
/* 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;
Modified: php/php-src/trunk/ext/odbc/php_odbc.c
===================================================================
--- php/php-src/trunk/ext/odbc/php_odbc.c 2009-12-06 17:38:31 UTC (rev 291771)
+++ php/php-src/trunk/ext/odbc/php_odbc.c 2009-12-06 18:53:16 UTC (rev 291772)
@@ -981,6 +981,10 @@
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 @@
/* 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;
@@ -1565,13 +1563,7 @@
/* 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;