PHPverse 2025

Voting

: seven minus two?
(Example: nine)

The Note You're Voting On

charles dot fisher at arconic dot com
3 years ago
I am trying to rework ADOdb library calls to OCI, and I wrote this function today which is helping.

function OraQry(&$Results, $Query, $Binds = false) {
global $xdb;

$Results = oci_parse($xdb, $Query);

if($Binds) foreach($Binds as $BindNm => $BindValJunk)
oci_bind_by_name($Results, $BindNm, $Binds[$BindNm], -1);

oci_execute($Results, OCI_NO_AUTO_COMMIT);

return null;
}

This also has similarity to PDO in passing an array of bind variables, with the added benefit that if they are named numerically (starting at zero), then the call to the array() function can be omitted:

OraQry($rs,
'select status from all_tables where owner=:0 and table_name=:1',
[$owner, $table_name]);

while($arr = oci_fetch_assoc($rs)) echo $arr['STATUS'] . "\n";

<< Back to user notes page

To Top