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.