perl5-dbi/DBD-MariaDB

empty string inserted instead of NULL for binary values

ysth opened this issue · 2 comments

ysth commented

The following code stores a 0-length string instead of NULL as expected:

$dbh->do("drop table if exists bar");
$dbh->do("create table bar (foo blob)");
my $sth = $dbh->prepare("insert into bar (foo) values (?)");
my $value = undef;
$sth->bind_param(1, $value, DBI::SQL_BINARY);
$sth->execute();
ysth commented

This may be an issue with my DBI subclass; closing for now

pali commented

Hi! I tested your code sample with last DBD::MariaDB and it stores NULL into database. There is no empty string.