note 126261 added to function.oci-bind-by-name
| From: | charles dot fisher at arconic dot com | Date: | Wed, 21 Jul 2021 18:45:48 +0000 |
| Subject: | note 126261 added to function.oci-bind-by-name | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216632@lists.php.net to get a copy of this message | ||
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";
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 142.79.57.1)
----
Manual Page -- https://php.net/manual/en/function.oci-bind-by-name.php
Edit -- https://main.php.net/note/edit/126261
Del: integrated -- https://main.php.net/note/delete/126261/integrated
Del: useless -- https://main.php.net/note/delete/126261/useless
Del: bad code -- https://main.php.net/note/delete/126261/bad+code
Del: spam -- https://main.php.net/note/delete/126261/spam
Del: non-english -- https://main.php.net/note/delete/126261/non-english
Del: in docs -- https://main.php.net/note/delete/126261/in+docs
Del: other reasons-- https://main.php.net/note/delete/126261
Reject -- https://main.php.net/note/reject/126261
Search -- https://main.php.net/manage/user-notes.php