perl5-dbi / DBD-MariaDB

Perl MariaDB driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

empty string inserted instead of NULL for binary values

ysth opened this issue · comments

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();

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

commented

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