ID: 37059
Updated by: [EMAIL PROTECTED]
Reported By: a dot vigetti at provincia dot grosseto dot it
-Status: Open
+Status: Closed
Bug Type: OCI8 related
Operating System: debian linux 2.6.12-1-686-smp
PHP Version: 5.1.2
New Comment:
Fixed in 5.1 and HEAD.
You should use:
OCIBindByName ( $stmt, ":fileimage", $fileimage, -1, SQL_LBI);
And also note this:
ociexecute($stmt, $OCI_DEFAULT); <-- OCI_DEFAULT is not a variable,
it's a constant.
Previous Comments:
------------------------------------------------------------------------
[2006-04-12 16:00:34] a dot vigetti at provincia dot grosseto dot it
Description:
------------
Oracle library version 10G R2.
I need to insert into an oracle table with a long raw,
i can't change the column type because another application use the same
table and i can change the application.
I experinced the same problem with other version of php/oci libs/Oracle
database.
Reproduce code:
---------------
This is a small code example that fails:
<?php
/*
create table longRawTable( id number(10), fileimage long raw);
*/
$db=ocilogon("user","password", "database");
$qs = "insert into longRawTable (id, fileimage)" .
" values (:id, :fileimage)";
$stmt = OCIParse($db, $qs);
$i=1;
$fileimage = file_get_contents( "a_file" );
OCIBindByName ( $stmt, ":id", $i, -1);
OCIBindByName ( $stmt, ":fileimage", $fileimage, -1);
ociexecute($stmt, $OCI_DEFAULT);
ocicommit($db);
?>
When i try this script i obtain the following error:
Warning: ociexecute(): ORA-01461: can bind a LONG value only for insert
into a LONG column in ..../LongRow.php on line 13
Using a column of type LONG and storing data with the bin2hex function
all is OK.
Its a php or OCI problem?
I try a similar script in perl using DBD::Oracle on the same machine
linked with the same OCI libs without problems.
thanks
Aldo Vigetti
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37059&edit=1