Bug #69526 [NEW]: odbc_execute can't be executed twice on some drivers

From: Date: Fri, 24 Apr 2015 16:43:00 +0000
Subject: Bug #69526 [NEW]: odbc_execute can't be executed twice on some drivers
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192329@lists.php.net to get a copy of this message
From: einavitamar at gmail dot com Operating system: Windows PHP version: 5.6.8 Package: ODBC related Bug Type: Bug Bug description:odbc_execute can't be executed twice on some drivers Description: ------------ After odbc_prepare, when executing odbc_execute more than once, it fails starting the second time. It happens only in drivers that does not allow SQLDescribeParam to be called on a statement after its execution. By looking at the php odbc code, the reason is that SQLDescribeParam is called in odbc_execute instead of in odbc_prepare. It should be called only once per bound parameter, and it does not depend on the parameter value itself, so it should be called in odbc_prepare. This failure happens when using odbc both in TeraData and in Vertica. This failure happens only if there is parameter binding (for statements without variables it does not happen). The test script is for TeraData driver under windows. Test script: --------------- $conn = odbc_connect("driver={Teradata};DBCName=127.0.0.1;PortNumber=1025;DATABASE=dbname;",'user', 'pwd'); $sql = "SELECT * FROM einav where a >= ?;"; $stmt = odbc_prepare($conn,$sql); $params = array("abc"); odbc_execute($stmt,$params); odbc_result_all($stmt); odbc_execute($stmt,$params); odbc_result_all($stmt); Expected result: ---------------- Expected result: <table><tr><th>a</th></tr> <tr><td>abc</td></tr> <tr><td>cde</td></tr> </table> <table><tr><th>a</th></tr> <tr><td>abc</td></tr> <tr><td>cde</td></tr> </table> Actual result: -------------- <table><tr><th>a</th></tr> <tr><td>abc</td></tr> <tr><td>cde</td></tr> </table> PHP Warning: odbc_execute(): SQL error: [Teradata][ODBC Teradata Driver] Functi on Sequence Error, SQL state S1010 in SQLDescribeParameter in C:\Users\einav.000 \b.php on line 37 <h2>No rows found</h2> -- Edit bug report at https://bugs.php.net/bug.php?id=69526&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69526&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69526&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69526&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69526&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69526&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69526&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69526&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69526&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69526&r=support Expected behavior: https://bugs.php.net/fix.php?id=69526&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69526&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69526&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69526&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69526&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69526&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69526&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69526&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69526&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69526&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69526&r=mysqlcfg

« previous php.bugs (#192329) next »