Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #28561 : Cannot insert nor update a 'LONG' column with value more than 4000 characters
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 23rd January 21:52
External User
 
Posts: 1
Default #28561 : Cannot insert nor update a 'LONG' column with value more than 4000 characters



ID: 28561
Updated by: tony2001@php.net
Reported By: xavier at c-est-simple dot com
-Status: Open
+Status: Bogus
Bug Type: OCI8 related
Operating System: LINUX
PHP Version: 4.3.6
New Comment:

Try to execute this query using sqlplus or another query tool. You'll
get the same error.

Not a PHP bug -> bogus.


Previous Comments:
------------------------------------------------------------------------

[2004-05-28 18:23:24] xavier at c-est-simple dot com

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 this bug report at http://bugs.php.net/?id=28561&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666