Re: Re: Binding LOB input value to stored procedure with PDO_OCI
| From: | Jessie Hernandez | Date: | Wed, 03 Jan 2007 21:34:17 +0000 |
| Subject: | Re: Re: Binding LOB input value to stored procedure with PDO_OCI | ||
| References: | 1 2 3 4 5 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-4438@lists.php.net to get a copy of this message | ||
""Jessie Hernandez"" <jrhernandez05@gmail.com> wrote in message news:DB.EF.20008.3DF1C954@pb1.pair.com...
> Attached is an improved version of the patch, which does immediate cleanup
> of the LOB when possible and changes the driver parameters field from a
> integer to an array (to conform to the driver options format). This version
> also supports IN OUT LOB parameters.
>
> Right now, I'm creating a brand new stream for the LOB after the statement
> has been executed if it is an IN OUT LOB. Will this be the desired behavior,
> or should the original stream be updated with the changes from the stored
> procedure? Here is an example:
>
> -- ORACLE
>
> CREATE OR REPLACE PROCEDURE TEST_PDO(value2 IN OUT CLOB) AS
> BEGIN
> insert into pdoclob(value) values( dbms_lob.substr( value2, 50 ) );
> dbms_lob.writeAppend( value2, 8, ' worked!' );
> END;
>
> -- PHP
> <?php
> $connection = new PDO( 'oci:dbname=mydb', 'user', 'pass' );
>
> $clob = fopen( '/tmp/testpdo.txt', 'r+b' );
>
> /****
> * test.pdo contains the string "clob input/output"
> ****
>
> $s = $connection->prepare( 'begin test_pdo( ? ); end;' );
> $s->bindParam( 1, $clob, PDO::PARAM_LOB | PDO::PARAM_INPUT_OUTPUT, 0,
> array( PDO::OCI_PARAM_B_CLOB => true, PDO::OCI_PARAM_CREATE_TEMP_LOB =>
> true ) );
> $connection->beginTransaction();
> $s->execute();
> $connection->commit();
>
> echo stream_get_contents( $clob ); // will print "clob input/ouput worked!"
> ?>
>
>
> In the above example, should the string " worked!" be appended to the
> original stream (meaning testpdo.txt will get updated), or should a brand
> new stream be created (as it is currently being done in the patch)?
>
> As always, any comments/suggestions on the patch are welcome.
>
>
> Regards,
>
> Jessie Hernandez
>