Yii Framework Forum: OCI: Problem with large texts - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

OCI: Problem with large texts Sharing this issue with the community Rate Topic: -----

#1 User is offline   ricardograna 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 376
  • Joined: 31-March 09
  • Location:Manaus/AM - Brazil

Posted 24 September 2009 - 07:06 PM

Hello, there!

I found this bug (working with ORACLE) and found a solution, but I'm not sure if mine is the best way, so I want to see your opinions


These days I had to develop a form with an text information around 4000 characters. I used first a VARCHAR(4000), but got an ORA-01461 error:
<h3 class="r">can bind a LONG value only for insert into a LONG column</h3> After extensive search, I realized the following:
VARCHAR only supports 4000characters long. It's a good number of chars, but in multibytescollations (i.e., UTF8) , this limit decreases to 1333 chars (it uses 3 bytes tohandle it properly).
Above this limit, PDO treats the column as LONG, and requires thePDO::PARAM_LOB as param type (Instead of, the ORA-01461 error message israised)


Above this limit we can use the CLOB type (Character Large OBject).

BUT, PDO doesn't recognizes PDO::PARAM_LOB as a valid type for CLOBs!!! It is a bug apparently without solution!

Also, CLOBs are charged by Yii as resource streams, so it requires some special treatment.




Oracle and forum developers, do you have some opinion about how can we handle with this problem?
Yes, It Is!
0

#2 User is offline   Snake 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 03-August 11
  • Location:United States of America

Posted 25 October 2011 - 09:30 AM

Yeah... I know this is an old post... but it is currently my problem. I have a custom DB2 schema in place that works well with the exception of handling the CLOB datatype. Is there anything I can do with this?? Its really got me stumped. :huh:
0

#3 User is offline   Blair 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 30-June 11

Posted 19 December 2012 - 02:52 PM

I was getting ORA-01461 when inserting/updating Oracle table with varchar2(4000) columns.

I found line 300 in PHP PDO source php-5.4.9/ext/pdo_oci/oci_statement.c:

value_sz = 1332; /* maximum size before value is interpreted as a LONG value */

Not sure why. Looked back thru Github source, and found someone changed value from 4000 to 1332 in Jan, 2007.

I changed it to "value_sz = 4000;", recompiled PHP, and the inserts/updates work fine. I don't know how this affects CLOBs or LONGs, but I'm using neither.

Reported as PHP bug:

https://bugs.php.net/bug.php?id=63809
1

#4 User is offline   Monirul 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 12-November 12

Posted 18 April 2014 - 05:09 AM

use LONG VARCHAR instead of VARCHAR. LONG VARCHAR supports a maximum length of 32,700 characters.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users