Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.0

Bug #58 ODBC result not freed for UPDATE and INSERT
Submitted: 2003-10-03 09:41 UTC
From: ecarpenter at itex dot co dot za Assigned: danielc
Status: Bogus Package: DB
PHP Version: 4.3.1 OS: Linux
Roadmaps: (Not assigned)    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 39 + 37 = ?

 [2003-10-03 09:41 UTC] ecarpenter at itex dot co dot za
Description: ------------ No records set are returned from a stored procedure if an UPDATE or an INSERT query was done before calling the SP. Database: Sybase ASA 8.0.2 (4289) Connect type: ODBC Reproduce code: --------------- <?php include "DB.php"; $DBase = DB::connect("odbc://dba:sql@tams"); $Result = $DBase->query("update <> set test2='testing' where test1=1"); $Qry = $DBase->query("call TestSP()"); while ($Row = $Qry->fetchrow()) { print_r($Row); } ?> CREATE PROCEDURE DBA."TestSP" () RESULT (Msg varchar(20)) BEGIN DECLARE LOCAL TEMPORARY TABLE TempTable ( MSG varchar(20) ); insert into TempTable values('testing this bug'); select MSG from TempTable; END Expected result: ---------------- 1. The test table is updated 2. The stored procedure returns a 1 row result that should be displayed in the while loop. Actual result: -------------- 1. The test table is updated 2. The stored procedure returns a 1 row result however the while loop is not entered. This problem can be fixed by doing a odbc_free_result on the returning result of the UPDATE instruction. The problem can be solved by added the following code to the start of the simpleQuery function in odbc.php if ($this->manip_result) { @odbc_free_result($this->manip_result); $this->manip_result=0; }//if I do not know what I am breaking with the above code ;)


 [2004-02-04 08:03 UTC] danielc
This could also be solved by adding a call to DB_result::free() in your script, for example: $Result->free(); Placing a free call inside simpleQuery() would interfere with situations where users want to do things with the output from modify queries.