Blobs broken in DBD-mysql-3.0002_4?

Blobs broken in DBD-mysql-3.0002_4?

am 16.01.2006 01:15:57 von beaucox

Hi -

Access to blobs seems to be broken in DBD-mysql-3.0002_4
( works fine in DBD-mysql-3.0002 ). I am using perl-5.8.7 and
DBI-1.50 on Gentoo Linux.

Here are the results of my small script ( posted below )
using DBD-mysql-3.0002_4:

$ perl testblob.pl
'blob_test' table created.
blob inserted.
blob select executed.
Out of memory!
Out of memory!
Callback called exit.

Seems to blow up on the fetch.

'testblob.pl' test script:

#-----start------
use strict;
use warnings;
use DBI;

my $database = 'test'; # <- set to your value
my $user = 'whatever'; # <- set to your value
my $password = 'whatever'; # <- set to your value

my $blob_length = 4_096;

my $blob = '';
my $chr = 0;
$blob .= chr( $chr++ % 256 ) for( 1..$blob_length );

my $dbh = DBI->connect( "DBI:mysql:$database",
$user, $password,
{ RaiseError => 1,
PrintError => 1,
AutoCommit => 0,
} );

$dbh->do( "drop table if exists blob_test;" );
$dbh->do( <<"*EOF*" );
create table if not exists blob_test
(
id integer not null,
chunk longblob,
primary key (id)
);
*EOF*
print "'blob_test' table created.\n";

my $sth = $dbh->prepare( <<"*EOF*" );
insert blob_test
( id, chunk )
values ( ?, ? );
*EOF*
$sth->execute( 1, $blob );
$sth->finish;
print "blob inserted.\n";

my $sav_len = $dbh->{LongReadLen};
$dbh->{LongReadLen} = $blob_length+1024;
$sth = $dbh->prepare
( "select chunk from blob_test where id=1;" );
$sth->execute;
print "blob select executed.\n";
my $ar = $sth->fetch;
print "blob select fetched.\n";
die "no data\n" unless $ar and $ar->[0];
$sth->finish;
$dbh->{LongReadLen} = $sav_len;

$dbh->disconnect;
print "all done.\n";
#------end-----

--
Aloha => Beau;


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org