|
Posted by Colin McKinnon on 11/22/05 00:32
naph wrote:
> Hi, I've had this problem, and managed to solve it now (i don't know
> how well yet, but it works) so i thought i'd post the solution because
> i couldn't find it anywhere.
>
> The problem I was having was we have lots of functions that return
> sys_refcursor's that we use as recordsets through ADO with a windows
> application, but then we needed to call these same functions from PHP,
> so the solution was to use cursors, like so...
>
> <?
>
> $cnn = OCILogon( 'User', Password', 'TNS' );
> $cur = OCINewCursor( $cnn );
> $stmt = OCIParse( $cnn, " begin :MyRefCur := MyFunction( 1, 2, 3 );
> end; " );
>
> OCIBindByName( $stmt, ":MyRefCur", $cur, -1, OCI_B_CURSOR );
> OCIExecute( $stmt );
> OCIExecute( $cur );
>
> while ( OCIFetchInto($cur,$row,OCI_ASSOC) )
> foreach ( $row as $name => $value )
> echo "$name = '$value'<br />";
>
> OCIFreeStatement( $stmt );
> OCIFreeCursor( $cur );
> OCILogoff( $cnn );
>
> ?>
>
> Maybe someone else has a better solution?
I'm constantly amazed how Oracle manages to infest everything it touches.
SQL, C, PHP, it just gets sooooo complicated and unreadable.
There are lots of database abstraction layers for PHP, good ones include dbx
and adodb.
C.
Navigation:
[Reply to this message]
|