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

Request #1338 Permit oci8:execute() bind output
Submitted: 2004-05-04 19:35 UTC
From: dave at mausner dot us Assigned: danielc
Status: Duplicate Package: DB
PHP Version: 4.3.5 OS: win2000
Roadmaps: (Not assigned)    
Subscription  


 [2004-05-04 19:35 UTC] dave at mausner dot us
Description: ------------ because execute is defined as "execute($stmt,$data)" one cannot bind to output variables -- only input variables. if one prepares a package function call which outputs results via its parameters, the binding occurs but the output data values are not transmitted back to the caller of execute. ... therefore, i request that you consider a way to make an output binding succeed via PEAR. i would consider any of these a fair alternative: (a) a special "prepare" binding code character which indicates an output value which is copied back thru another array; (b) changing the prototype to "execute($stmt,&$data)" so that the binding occurs in the callers address space; (c) anything else which is reasonable. ... here is a workaround: consider the case of: $code = "begin dbms_output.get_line(:M,:S); end;"; this code returns a message into :M and a status into :S. the explicit binding codes are necessary because "?" is bound to the address space of "execute" and is thus inaccessible. $sth = $dbh->prepare($code); it is necessary to mix metaphors by calling the OCI8 API: ociBindByName($sth,":M",$msg,255); ociBindByName($sth,":S",$okk,NULL); which allows me to bind to my own address space: while (true) { $res =& $dbh->execute($sth); if ($okk) break; echo("$msg\n"); } the above WORKS but is contrary to the spirit of PEAR. Reproduce code: --------------- $sth = $dbh->prepare(begin dbms_output.enable(1000); dbms_output.put_line('Hello.'); end;"); $dbh->execute($sth); $sth = $dbh->prepare("begin dbms_output.get_line(?,?); end;"); $msg = "NONE RETURNED"; $okk = 99; while (true) { $dbh->execute($sth,array($msg,$okk); if ($okk) break; echo("$msg\n"); } echo($okk); Expected result: ---------------- Hello. 1 Actual result: -------------- NONE RETURNED 99

Comments

 [2005-02-20 17:56 UTC] danielc
Look at bug 104.