mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 22:28:47 -04:00
fixed a case where bind param is undef (which should be converted to NULL)
This commit is contained in:
parent
0cd3997830
commit
9b227e74f4
2 changed files with 9 additions and 2 deletions
|
@ -185,7 +185,7 @@ sub FILTER {
|
||||||
my ($self, $idxNum, $idxStr, @values) = @_;
|
my ($self, $idxNum, $idxStr, @values) = @_;
|
||||||
|
|
||||||
# escape '\' and '}' in values before they are sprintf'ed into q{%s}
|
# escape '\' and '}' in values before they are sprintf'ed into q{%s}
|
||||||
@values = map {quotemeta($_)} @values;
|
@values = map {defined $_ ? quotemeta($_) : 'NULL'} @values;
|
||||||
|
|
||||||
# build a method coderef to fetch matching rows
|
# build a method coderef to fetch matching rows
|
||||||
my $perl_code = 'sub {my ($self, $i) = @_; my $row = $self->row($i); '
|
my $perl_code = 'sub {my ($self, $i) = @_; my $row = $self->row($i); '
|
||||||
|
|
|
@ -42,7 +42,7 @@ my @interpolation_attempts = (
|
||||||
# '$0',
|
# '$0',
|
||||||
# '$self',
|
# '$self',
|
||||||
|
|
||||||
plan tests => 4 + 2 * 13 + @interpolation_attempts + 8;
|
plan tests => 4 + 2 * 15 + @interpolation_attempts + 8;
|
||||||
|
|
||||||
my $dbh = connect_ok( RaiseError => 1, AutoCommit => 1 );
|
my $dbh = connect_ok( RaiseError => 1, AutoCommit => 1 );
|
||||||
|
|
||||||
|
@ -111,6 +111,13 @@ sub test_table {
|
||||||
|
|
||||||
$res = $dbh->selectcol_arrayref($sql, {}, '{');
|
$res = $dbh->selectcol_arrayref($sql, {}, '{');
|
||||||
is_deeply $res, [], $sql;
|
is_deeply $res, [], $sql;
|
||||||
|
|
||||||
|
$res = $dbh->selectcol_arrayref($sql, {}, undef);
|
||||||
|
is_deeply $res, [], $sql;
|
||||||
|
|
||||||
|
$sql = "SELECT a FROM $table WHERE c IS ?";
|
||||||
|
$res = $dbh->selectcol_arrayref($sql, {}, undef);
|
||||||
|
is_deeply $res, [7], $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub test_match_operator {
|
sub test_match_operator {
|
||||||
|
|
Loading…
Add table
Reference in a new issue