From:             xavier at c-est-simple dot com
Operating system: LINUX
PHP version:      4.3.6
PHP Bug Type:     OCI8 related
Bug description:  Cannot insert nor update a 'LONG' column with value more than 4000 
characters

Description:
------------
When trying to update or insert a 'LONG' column on an Oracle database, a
"OCIStmtExecute: ORA-01704: string literal too long" error occurs when the
value is more than 4000 characters.

This has been checked with PHP Version 4.3.7RC2-dev
as well.

config options:
'--enable-dio' '--with-mcrypt' '--without-mysql'
'--with-oci8=/opt/oracle/817' '--with-apxs=/home/user/php/apache/bin/apxs'
'--enable-debug' 

The bug #17063 was related but rather old, with no feedback and on a
different OS, so I thought it better to open a new one.


Reproduce code:
---------------
After creating an Oracle table such as :
CREATE TABLE OCI_BUG ( 
  TEXT  LONG, 
  ID    NUMBER)
Insert 

run the script above :

<?
$conn = OCIpLogon("user","passwd","schema");

$texte = str_pad("", 3990, 'a');
do
{
   $texte .=  'a';
   $longueur = strlen($texte);
   print "$longueur\n";
   $query = "update OCI_BUG set TEXT='$texte' where id=1" ;
   //$query = "insert into OCI_BUG (TEXT, ID) VALUES ('$texte',
$longueur)" ;
   $parsed = OCIParse($conn, $query);
   OCIExecute($parsed);
   $err = ocierror($parsed) ;
} while(!$err && ($longueur < 4050)) ;

OCIFreeStatement($parsed);
OCILogoff($conn);
?>

The query can be changed to either update or insert by switching the
comments with no other modification.
NB : the problem occurs on the update query even when there is no row to
update.

Expected result:
----------------
A list of lines showing numbers from 3991 to 4050, as shown below :
3991
3992
3993
3994
3995
...
...
4044
4045
4046
4047
4048
4049
4050

Actual result:
--------------
An error occurs for a 4001 character value.

3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
PHP Warning:  ociexecute(): OCIStmtExecute: ORA-01704: string literal too
long
 in /home/xavier/FMK/ocibug.php on line 13

Warning: ociexecute(): OCIStmtExecute: ORA-01704: string literal too long
 in /home/xavier/FMK/ocibug.php on line 13

The value is not inserted (or updated) in the table.


-- 
Edit bug report at http://bugs.php.net/?id=28561&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28561&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28561&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28561&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28561&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28561&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28561&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28561&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28561&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28561&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28561&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28561&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28561&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28561&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28561&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28561&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28561&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28561&r=float

Reply via email to