diff options
author | Felipe Pena <felipe@php.net> | 2009-12-06 18:53:16 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2009-12-06 18:53:16 +0000 |
commit | be06106d62db89c8b046f1708e49b05636d1100f (patch) | |
tree | 068a7b461eb7050117c19eab7fd747ded7c84097 /ext/odbc/php_odbc.c | |
parent | cfa096dd4d888b80390ddacea5105d7d13077752 (diff) | |
download | php-git-be06106d62db89c8b046f1708e49b05636d1100f.tar.gz |
- 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)
Diffstat (limited to 'ext/odbc/php_odbc.c')
-rw-r--r-- | ext/odbc/php_odbc.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index b7f2c26c41..00e3b72bd2 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -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; |