I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-04-05 00:41:31.533929-07 by pukeko
Is there a length limitation in DBD-msql and can it be circumvented?

I have a mysql database for which I'm using perl CGI and DBD::mysql to retrieve some data.

A table has a column called seq of type longtext which is correctly populated with a row having an entry in this column of size 408968 chars.

I can confirm that the entry is there correctly using the mysql console and a SELECT statement.

However, when I use DBD::mysql along the following lines:

my $sth = $dbh->prepare($select); $sth->execute; (...., my $seq, ...) = $sth->fetchrow_array; $sth->finish;

this row fails to return the $seq variable. Other elements in the same row_array are returned. There is no error logged.

The $select select statement is correct and the basic method is correct as the same code returns correctly for other rows. All rows where it fails seem to be ones where the seq entry is large.

The problem seems to occur for rows where the length of the element is somewhere between 130418 and 140793. (The table contains an autoincrement index so I am most reluctant to play around testing to whittle this range down but I suspect that the threshold is likely to be 2^17=131072.)

I am confident that the problem is not with either mysql (which can handle over 4 billion bytes for longtext fields) or perl (which has no string length limit). The machine has oodles of memory.

I wonder whether there is something buried in the DBD driver.

I would appreciate any insights into this and especially a solution.

The DBD::mysql doc page makes mention of mysql_length and mysql_max_length attributes. However, little explanation is given and it is far from clear whether or not they might be relevant.

Direct Responses: Write a response