|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-24 12:45 UTC] kristoff dot picard at ingres dot com
[2010-03-20 19:19 UTC] felipe@php.net
[2010-03-20 19:19 UTC] felipe@php.net
-Summary: Problem with odbc_autocommit
+Summary: odbc_autocommit doesn't work
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: felipe
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 14:00:01 2025 UTC |
Description: ------------ In PHP-version 5.3.0 the odbc_autocommit function with second parameter filled in always returns false. We tested this with sql server and progress database. In PHP-version 5.2.10 we don't have this problem. The actual result is the progress output from PHP 5.3.0. The expected result is the progress output from PHP 5.2.10. Reproduce code: --------------- <?php function reporterror($con, $extramsg) { echo $extramsg.'<br>'; $errnum = odbc_error($con); $errstr = odbc_errormsg ($con); echo 'error '.$errnum.' errmsg '.$errstr.'<br>'; } function setisolationlevel($con, $level) { $statement = 'SET TRANSACTION ISOLATION LEVEL ' . $level; $res = odbc_exec ($con, $statement); if ($res === FALSE) reporterror($con, 'exec failed '.$statement); } function starttransaction($con) { $res = odbc_autocommit ($con, false); if ($res !== TRUE) reporterror($con, 'odbc_autocommit false failed '); } function committransaction($con) { $res = odbc_commit($con); if ($res !== TRUE) reporterror($con, 'committransaction failed '); $res = odbc_autocommit ($con, true); $res = odbc_autocommit ($con, true); if ($res !== TRUE) reporterror($con, 'odbc_autocommit true failed '); } function test1($con) { echo 'test 1<br>'; setisolationlevel($con, 'READ UNCOMMITTED'); starttransaction($con); $rs = odbc_exec ($con, "SELECT * from tbloctsequence where seqname = 'testdanny'"); if ($rs === FALSE) { reporterror($con, 'exec failed'); echo 'exec failed<br>'; } else { echo 'exec succeeded<br>'; for (;;) { $ar = odbc_fetch_array($rs); if ($ar === FALSE) break; else { print_r($ar); echo '<br>'; } } odbc_free_result ($rs); } committransaction($con); } function test2($con) { echo 'test 2<br>'; setisolationlevel($con, 'READ COMMITTED'); starttransaction($con); $rs = odbc_exec ($con, "INSERT INTO tblLabelnamen (Naam) VALUES ('testdanny')" ); if ($rs === FALSE) { reporterror($con, 'exec failed'); echo 'exec failed<br>'; } else echo 'exec succeeded<br>'; committransaction($con); } $con = odbc_connect ( 'progresstest', 'test' , 'test'); // $con = odbc_connect ( 'mssqltest', 'test' , 'test'); if ($con == 0) { echo 'connect failed<br>'; } else { echo 'connect succeeded<br>'; test1($con); test2($con); odbc_close ($con ); } ?> Expected result: ---------------- connect succeeded test 1 exec succeeded test 2 exec succeeded Actual result: -------------- connect succeeded test 1 odbc_autocommit false failed error ?-? errmsg exec succeeded test 2 exec failed SET TRANSACTION ISOLATION LEVEL READ COMMITTED error S1000 errmsg [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Cannot change the transaction isolation level while in a transaction. (13742) odbc_autocommit false failed error S1000 errmsg [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Cannot change the transaction isolation level while in a transaction. (13742) exec failed error S1000 errmsg [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Statement not allowed in readonly isolation level (7671) exec failed