80 character limit with long data type?

From: Andy Dorman <adorman_at_ro.com>
Date: 1996/08/10
Message-ID: <4uiigu$k5s_at_news.ro.com>#1/1


Apologies in advance for the length of this posting but I don't want to leave anything out. I know I am going to feel like an idiot when I find out what is wrong.

I am working on a cgi script that enters and displays information on the www.  I am using the Apache web server on Solaris 2.4 x86 along with Perl 5.002 and the DBI 0.68 interface.

It has been remarkably easy (and productive) until recently when I tried to implement a LONG data type in one a data table. Then I ran up against an apparent 80 character display limit in Oracle for this data type. In other words, I can enter (SQL insert or update) long character strings with no difficulty. When I use SQLDBA and set longwidth to the appropriate length, I see the complete entry. However, when I retrieve this field using an SQL select statment through DBI, all I get are the first 80 characters! With some much appreciated advice from another Oracle Guru, I have executed "set longwidth 10000" before all my insert, update, and select SQL statements, but that hasn't helped.

Here is a snippet of the Perl code that returns only the first 80 characters of the BODY1 field which is defined as a LONG data type.



### LOAD DBI DRIVER & GET DRIVER HANDLE
$DRH = DBI->install_driver($DBI_DRIVER);
### CONNECT TO COMPASS DATABASE & GET DATABASE HANDLE
$DBH = $DRH->connect( 'tablename', 'username', 'password' );
### SET LENGTH OF LONG DATA TYPE TO MAX OF 10,000 CHARACTERS
$SQL = "SET LONGWIDTH 10000";
$ST = $DBH->do($SQL);
$ST = undef;

### DO A DATABASE QUERY FOR DATA RECORD
$SQL = "select HEADLINE, DATE_D, ARTICLE_TYPE, BODY1, PUBLISH_FLAG from
watch where ROWID = \'$ROW\'";
$ST = $DBH->prepare($SQL);
$ST->execute;

### BUILD THE DISPLAY
  _at_arr = $ST->fetchrow();
### First, decode any single quotes in the Body that had been encoded by the database
$arr[3] =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
### Next, decode HTML tags in the Body for putting in the multiline text field
$arr[3] =~ s/\&/&amp;/g;
$arr[3] =~ s/\"/&quot;/g;
$arr[3] =~ s/\>/&gt;/g;
$arr[3] =~ s/\</&lt;/g;
$SHOWBODY = "<B>Body</B><BR><TEXTAREA NAME=\"body\" ROWS=\"20\" COLS=\"60\"
WRAP=\"VIRTUAL\">$arr[3]</TEXTAREA>";

The variable $SHOWBODY implements a textarea input field in an HTML form using the contents of the BODY1 field. And no matter what I insert in this field, I never see more than the first 80 characters.

Does anyone know what I am doing wrong? or have left out? or have any suggestions for something else to try?

Thank you in advance. Received on Sat Aug 10 1996 - 00:00:00 CEST

Original text of this message