Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to Assign large amt of txt to var (MySQL->Perl)

Status
Not open for further replies.

Rick7

IS-IT--Management
Apr 15, 2003
16
US
Hi, All:

I need a way to store a large text string (approx 500 char) from a MySQL query into a Perl Variable. Currently, I am using the following method:

$pointer = $sth->fetchrow_hashref;
$glossDef = $pointer->{'glossDef'};

The problem is that glossDef is larger than 255 char, and it is being truncated.

Any help would be MUCH appreciated.

Rick
 
How is glossDef defined in the table? Is it a char/varchar or text? I just ran a test and had no problems pulling back a 1400 stored in a col w/ text datatype. char/varchar on the otherhand can only store upto 255 bytes per col.
 
Thanks so much for your response. The variable is text. I just dug a little deeper and found that there were double quotes in the text string. It appeared that the data was being truncated at the double quote. I replaced the double quote with singles ones, and it seems to have fixed it.

I was just wondering... Do you have any idea what the maximum amount of data is that can be assigned to a string variable in Perl?
 
There isn't any real limit. Basically perl will use as much memory as it can. If you have 2 GB of free memory a single string could theoretically eat the whole 2GB.
 
Your double quote truncation could be down to the setup of your MySQL database -field seperator

HTH
--Paul
 
Thanks very much for the info!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top