#34852 [Com]: [PATCH] Failure in odbc_exec() using oracle-supplied odbc driver

From: Date: Fri, 31 Mar 2006 04:56:05 +0000
Subject: #34852 [Com]: [PATCH] Failure in odbc_exec() using oracle-supplied odbc driver
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95146@lists.php.net to get a copy of this message
ID: 34852 Comment by: adrian dot chadd at uwa dot edu dot au Reported By: tim dot tassonis at trivadis dot com Status: No Feedback Bug Type: ODBC related Operating System: Linux PHP Version: 5CVS-2005-11-03 (cvs) New Comment: We're having the same problem: matrix:~# php5 -v PHP 5.1.2-1 (cli) (built: Jan 18 2006 06:49:47) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies matrix:~# cat adri.php5 <?php $connect = odbc_connect(auth and db stuff goes here); $result = @odbc_data_source($connect, SQL_FETCH_FIRST); while ($result) { print "result:\n"; print_r($result); print "\n"; $result = @odbc_data_source($connect, SQL_FETCH_NEXT); } $res = odbc_prepare($connect, "SELECT * FROM FOO"); odbc_close($connect); ?> matrix:~# php5 adri.php5 result: Array ( [server] => HISDEV [description] => OracleODBC-10g ) Warning: odbc_prepare(): SQL error: [unixODBC][Driver Manager]Driver does not support this function, SQL state IM001 in SQLSetStmtOption in /root/adri.php5 on line 12 matrix:~# dpkg -l | grep odbc rc odbcinst1 2.2.4-11 Support library and helper program for acces ii odbcinst1debia 2.2.11-10 Support library and helper program for acces ii php5-odbc 5.1.2-1 ODBC module for php5 ii unixodbc 2.2.11-10 ODBC tools libraries Can someone shed some light on this? What can/should I try? adrian Previous Comments: ------------------------------------------------------------------------ [2005-12-20 01:00:05] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2005-12-12 10:31:21] sniper@php.net Can you repeat this error when using the PDO odbc ?? ------------------------------------------------------------------------ [2005-11-30 21:09:46] sniper@php.net Unfortunately Dan can not be involved in this. (some license thing) ------------------------------------------------------------------------ [2005-11-04 01:49:46] wez@php.net Tony: Check with Dan Scott before applying this patch; he's probably most current on this aspect of the odbc extension. ------------------------------------------------------------------------ [2005-10-13 13:34:40] tim dot tassonis at trivadis dot com Well, here is a patch. I dont know whether the formatting is preserved her properly, it should apply cleanly with "patch -p1 < patchfile" from whithing the php-5.0.5 directory. The patch just stops odbc_exec and odbc_prepare from failing if the SQLSetStmtOption fails. The warning is still displayed in the error_log. It would be great if this could be applied. So below follows the patch (created with diff -ruN): diff -ruN php-5.0.5/ext/odbc/php_odbc.c php-5.0.5-ora/ext/odbc/php_odbc.c --- php-5.0.5/ext/odbc/php_odbc.c 2005-07-03 00:50:01.000000000 +0200 +++ php-5.0.5-ora/ext/odbc/php_odbc.c 2005-10-13 12:20:55.000000000 +0200 @@ -875,9 +875,11 @@ if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); + /* Dont fail, but go on. This can happen SQLFreeStmt(result->stmt, SQL_DROP); efree(result); RETURN_FALSE; + */ } } } else { @@ -1296,9 +1298,11 @@ if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); + /* Dont fail, but go on. This can happen SQLFreeStmt(result->stmt, SQL_DROP); efree(result); RETURN_FALSE; + */ } } } else { ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/34852 -- Edit this bug report at http://bugs.php.net/?id=34852&edit=1

« previous php.bugs (#95146) next »