mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 14:19:10 -04:00
resolved #61958
This commit is contained in:
parent
bc8755654d
commit
6e8c062baa
2 changed files with 15 additions and 1 deletions
|
@ -175,6 +175,7 @@ sub install_collation {
|
|||
# (see http://www.sqlite.org/vtab.html#xfindfunction)
|
||||
sub regexp {
|
||||
use locale;
|
||||
return if !defined $_[0] || !defined $_[1];
|
||||
return scalar($_[1] =~ $_[0]);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ BEGIN {
|
|||
}
|
||||
use Test::NoWarnings;
|
||||
|
||||
plan tests => 2 * (1 + 2 * @regexes) * @CALL_FUNCS + 1;
|
||||
plan tests => 2 * (3 + 2 * @regexes) * @CALL_FUNCS + 1;
|
||||
|
||||
BEGIN {
|
||||
# Sadly perl for windows (and probably sqlite, too) may hang
|
||||
|
@ -71,6 +71,19 @@ foreach my $call_func (@CALL_FUNCS) {
|
|||
my $db_antimatch = $dbh->selectcol_arrayref($sql);
|
||||
is_deeply(\@perl_antimatch, $db_antimatch, "NOT REGEXP '$regex'");
|
||||
}
|
||||
|
||||
# null
|
||||
{
|
||||
my $sql = "SELECT txt from regexp_test WHERE txt REGEXP NULL "
|
||||
. "COLLATE perllocale";
|
||||
my $db_match = $dbh->selectcol_arrayref($sql);
|
||||
|
||||
is_deeply([], $db_match, "REGEXP NULL");
|
||||
|
||||
$sql =~ s/REGEXP/NOT REGEXP/;
|
||||
my $db_antimatch = $dbh->selectcol_arrayref($sql);
|
||||
is_deeply([], $db_antimatch, "NOT REGEXP NULL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue