mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 14:19:10 -04:00
fixed mixed EOLs and removed redundant blank lines
This commit is contained in:
parent
11c2f4e70f
commit
fc55eeb0d7
40 changed files with 867 additions and 975 deletions
|
@ -28,4 +28,3 @@ ok( $sth->execute, '->execute ok' );
|
|||
my $names = $sth->{NAME};
|
||||
is( scalar(@$names), 4, 'Got 4 columns' );
|
||||
is_deeply( $names, [ 'f1', 'f1', 'f2', 'f3' ], 'Table prepending is disabled by default' );
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ foreach my $call_func (@CALL_FUNCS) { for my $flags (@function_flags) {
|
|||
$result = $dbh->selectall_arrayref( "SELECT newcount() FROM aggr_test GROUP BY field" );
|
||||
ok( @$result == 3 && $result->[0][0] == 1 && $result->[1][0] == 1 );
|
||||
|
||||
|
||||
# Test aggregate on empty table
|
||||
$dbh->do( "DROP TABLE aggr_empty_test;" );
|
||||
$dbh->do( "CREATE TABLE aggr_empty_test ( field )" );
|
||||
|
|
|
@ -47,17 +47,13 @@ sub by_num_desc ($$) {
|
|||
$_[1] <=> $_[0];
|
||||
}
|
||||
|
||||
|
||||
# collation 'no_accents' will be automatically loaded on demand
|
||||
$DBD::SQLite::COLLATION{no_accents} = \&no_accents;
|
||||
|
||||
|
||||
$" = ", "; # to embed arrays into message strings
|
||||
|
||||
my $sql = "SELECT txt from collate_test ORDER BY txt";
|
||||
|
||||
|
||||
|
||||
# test interaction with the global COLLATION hash ("WriteOnce")
|
||||
|
||||
dies (sub {$DBD::SQLite::COLLATION{perl} = sub {}},
|
||||
|
@ -79,8 +75,6 @@ delete $tied->{foo};
|
|||
$DBD::SQLite::COLLATION{foo} = \&by_num_desc; # override, no longer dies
|
||||
is($DBD::SQLite::COLLATION{foo}, \&by_num_desc, "overridden collation");
|
||||
|
||||
|
||||
|
||||
# now really test the collation functions
|
||||
|
||||
foreach my $call_func (@CALL_FUNCS) {
|
||||
|
@ -126,7 +120,6 @@ foreach my $call_func (@CALL_FUNCS) {
|
|||
is_deeply(\@sorted, $db_sorted,
|
||||
"collate no_accents (@sorted // @$db_sorted)");
|
||||
|
||||
|
||||
# manual addition of a collation for this dbh
|
||||
$dbh->$call_func(by_length => \&by_length, "create_collation");
|
||||
@sorted = sort by_length @words;
|
||||
|
@ -135,7 +128,3 @@ foreach my $call_func (@CALL_FUNCS) {
|
|||
"collate by_length (@sorted // @$db_sorted)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ foreach my $call_func (@CALL_FUNCS) {
|
|||
# now the progress handler should have been called a number of times
|
||||
ok($n_callback);
|
||||
|
||||
|
||||
# unregister the progress handler, set counter back to zero, do more work
|
||||
ok($dbh->$call_func( $N_OPCODES, undef, "progress_handler" ));
|
||||
$n_callback = 0;
|
||||
|
|
|
@ -110,7 +110,6 @@ SCOPE: {
|
|||
ok( $sth->finish, '->finish' );
|
||||
}
|
||||
|
||||
|
||||
# Delete the test row from the table
|
||||
ok( $dbh->do('DELETE FROM ONE WHERE id = 2 AND name IS NULL'), 'DELETE' );
|
||||
|
||||
|
|
|
@ -74,4 +74,3 @@ sub dumpblob {
|
|||
}
|
||||
if ($ENV{SHOW_BLOBS}) { close(OUT) }
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,6 @@ use Test::More tests => 28;
|
|||
|
||||
my $warning_count = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
#####################################################################
|
||||
# Support functions
|
||||
|
||||
|
@ -32,10 +29,6 @@ sub rows {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#####################################################################
|
||||
# Main Tests
|
||||
|
||||
|
|
|
@ -51,4 +51,3 @@ isnt $types->[0], 'VARCHAR(2)', '$sth->{TYPE}[0] doesn\'t return a string';
|
|||
isnt $types->[1], 'CHAR(1)', '$sth->{TYPE}[1] doesn\'t return a string';
|
||||
like $types->[0], qr/^-?\d+$/, '$sth->{TYPE}[0] returns an integer';
|
||||
like $types->[1], qr/^-?\d+$/, '$sth->{TYPE}[1] returns an integer';
|
||||
|
||||
|
|
|
@ -98,7 +98,6 @@ foreach my $subdir ( 'longascii', 'adatb
|
|||
unlink(_path($dbfilex)) if -e _path($dbfilex);
|
||||
}
|
||||
|
||||
|
||||
# connect to an empty filename - sqlite will create a tempfile
|
||||
eval {
|
||||
my $dbh = DBI->connect("dbi:SQLite:dbname=", undef, undef, {
|
||||
|
@ -110,9 +109,6 @@ eval {
|
|||
is( $@, '', "Could connect to temp database (empty filename)" );
|
||||
diag( $@ ) if $@;
|
||||
|
||||
|
||||
|
||||
|
||||
sub _path { # copied from DBD::SQLite::connect
|
||||
my $path = shift;
|
||||
|
||||
|
|
|
@ -139,4 +139,3 @@ is_deeply $info, [$table2_info, @systable_info, $table4_info, $table3_info, $tab
|
|||
#warn 'Schema Names', substr Dumper($dbh->table_info('', '%', '')->fetchall_arrayref), 5;
|
||||
#warn 'Table Types', substr Dumper($dbh->table_info('', '', '', '%')->fetchall_arrayref), 5;
|
||||
#warn 'table_info', substr Dumper($info), 5;
|
||||
|
||||
|
|
|
@ -122,20 +122,17 @@ foreach my $call_func (@CALL_FUNCS) {
|
|||
[DBD::SQLite::DELETE, 'hook_test', undef, 'temp', undef],
|
||||
"args to authorizer (DELETE)");
|
||||
|
||||
|
||||
# unregister the authorizer ... now DELETE should be authorized
|
||||
$dbh->$call_func(undef, "set_authorizer");
|
||||
eval {$dbh->do("DELETE FROM hook_test WHERE foo = 'auth_test'")};
|
||||
ok(!$@, "delete was accepted");
|
||||
|
||||
|
||||
# sqlite3 did warn in tests above, so avoid complains from Test::Warnings
|
||||
# (would be better to turn off warnings from sqlite3, but I didn't find
|
||||
# any way to do that)
|
||||
clear_warnings();
|
||||
}
|
||||
|
||||
|
||||
sub do_transaction {
|
||||
my $dbh = shift;
|
||||
|
||||
|
|
|
@ -34,8 +34,6 @@ use locale;
|
|||
|
||||
use DBD::SQLite;
|
||||
|
||||
|
||||
|
||||
foreach my $call_func (@CALL_FUNCS) {
|
||||
|
||||
for my $use_unicode (0, 1) {
|
||||
|
@ -85,4 +83,3 @@ foreach my $call_func (@CALL_FUNCS) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
12
t/43_fts3.t
12
t/43_fts3.t
|
@ -51,13 +51,12 @@ BEGIN {
|
|||
setlocale(LC_COLLATE, 'en-us');
|
||||
}
|
||||
}
|
||||
use locale;
|
||||
|
||||
use locale;
|
||||
|
||||
sub locale_tokenizer { # see also: Search::Tokenizer
|
||||
return sub {
|
||||
my $string = shift;
|
||||
|
||||
my $regex = qr/\w+/;
|
||||
my $term_index = 0;
|
||||
|
||||
|
@ -70,12 +69,8 @@ sub locale_tokenizer { # see also: Search::Tokenizer
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
use DBD::SQLite;
|
||||
|
||||
|
||||
|
||||
for my $use_unicode (0, 1) {
|
||||
|
||||
# connect
|
||||
|
@ -83,6 +78,7 @@ for my $use_unicode (0, 1) {
|
|||
|
||||
for my $fts (qw/fts3 fts4/) {
|
||||
next if $fts eq 'fts4' && !has_sqlite('3.7.4');
|
||||
|
||||
# create fts table
|
||||
$dbh->do(<<"") or die DBI::errstr;
|
||||
CREATE VIRTUAL TABLE try_$fts
|
||||
|
@ -104,7 +100,9 @@ for my $use_unicode (0, 1) {
|
|||
. "ENABLE_FTS3_PARENTHESIS option", scalar @tests
|
||||
unless DBD::SQLite->can('compile_options') &&
|
||||
grep /ENABLE_FTS3_PARENTHESIS/, DBD::SQLite::compile_options();
|
||||
|
||||
my $sql = "SELECT docid FROM try_$fts WHERE content MATCH ?";
|
||||
|
||||
for my $t (@tests) {
|
||||
my ($query, @expected) = @$t;
|
||||
@expected = map {$doc_ids[$_]} @expected;
|
||||
|
@ -114,5 +112,3 @@ for my $use_unicode (0, 1) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ CREATE TABLE song(
|
|||
);
|
||||
__EOSQL__
|
||||
|
||||
|
||||
plan tests => @sql_statements + 22;
|
||||
|
||||
my $dbh = connect_ok( RaiseError => 1, PrintError => 0, AutoCommit => 1 );
|
||||
|
@ -86,31 +85,26 @@ for ($fk_data->{albumeditor}) {
|
|||
is($_->{UNIQUE_OR_PRIMARY}, 'PRIMARY', "FK albumeditor, primary");
|
||||
}
|
||||
|
||||
|
||||
$sth = $dbh->foreign_key_info(undef, undef, 'artist',
|
||||
undef, undef, 'album');
|
||||
$fk_data = $sth->fetchall_hashref('FKCOLUMN_NAME');
|
||||
is_deeply([keys %$fk_data], ['albumartist'], "FK album with PK, only 1 result");
|
||||
|
||||
|
||||
$sth = $dbh->foreign_key_info(undef, undef, 'foobar',
|
||||
undef, undef, 'album');
|
||||
$fk_data = $sth->fetchall_hashref('FKCOLUMN_NAME');
|
||||
is_deeply([keys %$fk_data], [], "FK album with PK foobar, 0 result");
|
||||
|
||||
|
||||
$sth = $dbh->foreign_key_info(undef, undef, undef,
|
||||
undef, 'remote', undef);
|
||||
$fk_data = $sth->fetchall_hashref('FKCOLUMN_NAME');
|
||||
is_deeply([sort keys %$fk_data], [qw/albumartist albumeditor/], "FK remote.*, 2 results");
|
||||
|
||||
|
||||
$sth = $dbh->foreign_key_info(undef, 'remote', undef,
|
||||
undef, undef, undef);
|
||||
$fk_data = $sth->fetchall_hashref('FKCOLUMN_NAME');
|
||||
is_deeply([sort keys %$fk_data], [qw/songalbum songartist/], "FK with PK remote.*, 2 results");
|
||||
|
||||
|
||||
$sth = $dbh->foreign_key_info(undef, undef, undef,
|
||||
undef, undef, 'song');
|
||||
$fk_data = $sth->fetchall_hashref('FKCOLUMN_NAME');
|
||||
|
|
|
@ -14,6 +14,7 @@ use SQLiteTest qw/connect_ok @CALL_FUNCS/;
|
|||
use Test::NoWarnings;
|
||||
|
||||
plan tests => 16 * @CALL_FUNCS + 1;
|
||||
|
||||
for my $call_func (@CALL_FUNCS) {
|
||||
my $dbh = connect_ok(RaiseError => 1);
|
||||
$dbh->do('create table foo (id integer primary key autoincrement, "name space", unique_col integer unique)');
|
||||
|
|
|
@ -40,7 +40,6 @@ CREATE TABLE remote.b (
|
|||
|
||||
__EOSQL__
|
||||
|
||||
|
||||
plan tests => @sql_statements + 2 + 46 * 2;
|
||||
|
||||
my $dbh = connect_ok( RaiseError => 1, PrintError => 0, AutoCommit => 1 );
|
||||
|
|
|
@ -45,4 +45,3 @@ foreach my $call_func (@CALL_FUNCS) {
|
|||
note explain $db_match;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ for my $query (split m/ ; /xms, $slurp) {
|
|||
# Then we test the bug.
|
||||
#
|
||||
|
||||
|
||||
# We test with both 'DISTINCT(t.name) [..]' and 'DISTINCT t.name [..]'
|
||||
#
|
||||
my $query_with_parens = trim(q{
|
||||
|
|
|
@ -37,10 +37,6 @@ sub fetchrow_1 {
|
|||
is_deeply( $row, [ 1 ], 'Got row 1' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################################################################
|
||||
# A well-behaved non-cached statement
|
||||
|
||||
|
@ -74,10 +70,6 @@ SCOPE: {
|
|||
is( $c, 0, 'No warnings' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################################################################
|
||||
# A badly-behaved regular statement
|
||||
|
||||
|
@ -105,10 +97,6 @@ SCOPE: {
|
|||
is( $c, 1, 'Got a warning' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################################################################
|
||||
# A well-behaved cached statement
|
||||
|
||||
|
@ -151,10 +139,6 @@ SCOPE: {
|
|||
is( $c, 1, 'No warnings' );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#####################################################################
|
||||
# Badly-behaved prepare_cached (but still acceptable)
|
||||
|
||||
|
|
|
@ -54,4 +54,3 @@ $sth->execute;
|
|||
|
||||
# XXX: Panic occurs here when running under the debugger
|
||||
$dbh->commit or die $dbh->errstr;
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ my $str = "\x{20ac}";
|
|||
|
||||
{
|
||||
my $sth = $dbh->prepare('select * from test1 order by id');
|
||||
|
||||
$sth->execute;
|
||||
|
||||
my $expected = [undef, 1, 0, 0, 1, 1, 1];
|
||||
|
@ -58,6 +59,7 @@ my $str = "\x{20ac}";
|
|||
ok $row && utf8::is_utf8($row->[1]) == $expected->[$_],
|
||||
"row $_ is ".($expected->[$_] ? "unicode" : "not unicode");
|
||||
}
|
||||
|
||||
$sth->finish;
|
||||
}
|
||||
|
||||
|
@ -104,7 +106,6 @@ my $str = "\x{20ac}";
|
|||
my $expected = [undef, 0, 0, 0, 0, 0, 0];
|
||||
for (1..6) {
|
||||
$sth->fetch;
|
||||
|
||||
ok $col1 && $col1 == $_;
|
||||
ok $col2 && utf8::is_utf8($col2) == $expected->[$_],
|
||||
"row $_ is ".($expected->[$_] ? "unicode" : "not unicode");
|
||||
|
|
|
@ -95,7 +95,6 @@ sub unicode_test {
|
|||
}
|
||||
|
||||
{ # tests for an environment where everything is decoded
|
||||
|
||||
my $dbh = connect_ok(sqlite_unicode => 1);
|
||||
$dbh->do("pragma foreign_keys = on");
|
||||
my $unicode_quoted = $dbh->quote_identifier($unicode);
|
||||
|
|
|
@ -24,7 +24,6 @@ my $dbh = connect_ok(RaiseError => 1, AutoCommit => 1);
|
|||
my $sql = q{CREATE VIRTUAL TABLE foo USING fts4 (content="", a, b)};
|
||||
ok( $dbh->do($sql), 'CREATE TABLE' );
|
||||
|
||||
|
||||
ok($dbh->do("INSERT INTO foo(docid, a, b) VALUES(1, 'a', 'b')"),
|
||||
"insert without bind");
|
||||
|
||||
|
@ -48,4 +47,3 @@ ok($sth->execute(),
|
|||
ok( $dbh->do("CREATE VIRTUAL TABLE foo_aux USING fts4aux(foo)"), 'FTS4AUX');
|
||||
my $data = $dbh->selectcol_arrayref("select term from foo_aux where col='*'");
|
||||
is_deeply ([sort @$data], [qw/a aa aaa b bb bbb/], "terms properly indexed");
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ is $rows->[0]{rowid}, 5, "rowid column";
|
|||
is $rows->[0]{foo}, "auto_vivify:0", "foo column";
|
||||
is $rows->[0]{bar}, "auto_vivify:1", "bar column";
|
||||
|
||||
|
||||
$sql = "SELECT * FROM foobar ";
|
||||
$rows = $dbh->selectall_arrayref($sql, {Slice => {}});
|
||||
is scalar(@$rows), 5, "got 5 rows again";
|
||||
|
@ -31,7 +30,6 @@ $sql = "SELECT * FROM foobar WHERE foo > -1 and bar < 33";
|
|||
$rows = $dbh->selectall_arrayref($sql, {Slice => {}});
|
||||
is scalar(@$rows), 5, "got 5 rows (because of omitted constraints)";
|
||||
|
||||
|
||||
package DBD::SQLite::VirtualTable::T;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -49,7 +47,6 @@ sub NEW {
|
|||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub BEST_INDEX {
|
||||
my ($self, $constraints, $order_by) = @_;
|
||||
|
||||
|
@ -77,8 +74,6 @@ sub BEST_INDEX {
|
|||
return $outputs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
package DBD::SQLite::VirtualTable::T::Cursor;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -99,8 +94,6 @@ sub FILTER {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub EOF {
|
||||
my $self = shift;
|
||||
|
||||
|
@ -125,8 +118,4 @@ sub ROWID {
|
|||
return $self->{row_count};
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ my $sth = $dbh->prepare("SELECT * FROM barfoo");
|
|||
ok !$DBD::SQLite::VirtualTable::T::CREATE_COUNT, "no vtab created";
|
||||
is $DBD::SQLite::VirtualTable::T::CONNECT_COUNT, 1, "1 vtab connected";
|
||||
|
||||
|
||||
package DBD::SQLite::VirtualTable::T;
|
||||
use base 'DBD::SQLite::VirtualTable';
|
||||
|
||||
|
@ -71,4 +70,3 @@ sub DESTROY {$DESTROY_COUNT++}
|
|||
sub DESTROY_MODULE {$DESTROY_MODULE_COUNT++}
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ use Test::NoWarnings;
|
|||
|
||||
plan tests => 15;
|
||||
|
||||
|
||||
my $dbh = connect_ok( RaiseError => 1, PrintError => 0, AutoCommit => 1 );
|
||||
|
||||
$dbh->$sqlite_call(create_module => vtab => "DBD::SQLite::VirtualTable::T");
|
||||
|
@ -50,7 +49,6 @@ is $DBD::SQLite::VirtualTable::T::funcs{abs}{calls}, 1, "abs still 1";
|
|||
is $DBD::SQLite::VirtualTable::T::funcs{substr}{calls}, 1, "substr still 1";
|
||||
is $DBD::SQLite::VirtualTable::T::funcs{trim}{calls}, 1, "trim still 1";
|
||||
|
||||
|
||||
# new table : should issue new calls to FIND_FUNCTION
|
||||
ok $dbh->do("CREATE VIRTUAL TABLE barfoo USING vtab(foo INTEGER, bar INTEGER)"),
|
||||
"created barfoo";
|
||||
|
@ -66,7 +64,6 @@ is $DBD::SQLite::VirtualTable::T::funcs{abs}{calls}, 2, "abs now 2";
|
|||
is $DBD::SQLite::VirtualTable::T::funcs{substr}{calls}, 2, "substr now 2";
|
||||
is $DBD::SQLite::VirtualTable::T::funcs{trim}{calls}, 2, "trim now 2";
|
||||
|
||||
|
||||
# drop table : should free references to functions
|
||||
ok $dbh->do("DROP TABLE foobar");
|
||||
|
||||
|
@ -75,14 +72,11 @@ undef $dbh;
|
|||
|
||||
note "done";
|
||||
|
||||
|
||||
package DBD::SQLite::VirtualTable::T;
|
||||
use strict;
|
||||
use warnings;
|
||||
use base 'DBD::SQLite::VirtualTable';
|
||||
|
||||
|
||||
|
||||
sub BEST_INDEX {
|
||||
my ($self, $constraints, $order_by) = @_;
|
||||
|
||||
|
@ -106,7 +100,6 @@ sub BEST_INDEX {
|
|||
|
||||
our %funcs;
|
||||
|
||||
|
||||
sub FIND_FUNCTION {
|
||||
my ($self, $n_arg, $function_name) = @_;
|
||||
|
||||
|
@ -115,7 +108,6 @@ sub FIND_FUNCTION {
|
|||
return $func;
|
||||
}
|
||||
|
||||
|
||||
package DBD::SQLite::VirtualTable::T::Cursor;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
@ -136,8 +128,6 @@ sub FILTER {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub EOF {
|
||||
my $self = shift;
|
||||
|
||||
|
@ -162,8 +152,4 @@ sub ROWID {
|
|||
return $self->{row_count};
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,13 +22,11 @@ $dbh->do(<<"");
|
|||
$dbh->do(<<"");
|
||||
INSERT INTO base VALUES(2, 'foo2', '10_filecontent.t', 'bar2')
|
||||
|
||||
|
||||
# start tests
|
||||
|
||||
ok $dbh->$sqlite_call(create_module => fs => "DBD::SQLite::VirtualTable::FileContent"),
|
||||
"create_module";
|
||||
|
||||
|
||||
ok $dbh->do(<<""), "create vtable";
|
||||
CREATE VIRTUAL TABLE vfs USING fs(source = base,
|
||||
expose = "path, foo, bar",
|
||||
|
@ -51,9 +49,7 @@ is_deeply([sort keys %{$rows->[0]}], [qw/bar content foo path/], "col list OK");
|
|||
is $rows->[0]{bar}, 'bar1', 'got bar1';
|
||||
is $rows->[1]{bar}, 'bar2', 'got bar2';
|
||||
|
||||
|
||||
# expensive request (reads content from all files in table) !
|
||||
$sql = "SELECT * FROM vfs WHERE content LIKE '%filesys%'";
|
||||
$rows = $dbh->selectall_arrayref($sql, {Slice => {}});
|
||||
is scalar(@$rows), 1, "got 1 row";
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ $dbh->do("CREATE TABLE files (id INTEGER PRIMARY KEY, path TEXT)");
|
|||
my $sth = $dbh->prepare("INSERT INTO files(path) VALUES (?)");
|
||||
$sth->execute($_) foreach @perl_files;
|
||||
|
||||
|
||||
# create the virtual table
|
||||
$dbh->$sqlite_call(create_module => fc => "DBD::SQLite::VirtualTable::FileContent");
|
||||
$dbh->do(<<"");
|
||||
|
@ -92,7 +91,6 @@ foreach my $test (@tests) {
|
|||
my $remove_path = 'lib/DBD/SQLite/VirtualTable.pm';
|
||||
$dbh->do("DELETE FROM fts WHERE path='$remove_path'");
|
||||
|
||||
|
||||
# test again
|
||||
foreach my $test (@tests) {
|
||||
my ($pattern, @expected) = @$test;
|
||||
|
@ -113,4 +111,3 @@ foreach my $test (@tests) {
|
|||
my $paths = $dbh->selectcol_arrayref($sql, {}, $pattern);
|
||||
is_deeply([sort @$paths], \@expected, "search '$pattern' -- after reconnect");
|
||||
}
|
||||
|
||||
|
|
|
@ -39,14 +39,12 @@ is scalar(@$res), 3, "got 3 rows";
|
|||
is $res->[0]{a}, 1, 'got 1 in a';
|
||||
is $res->[0]{b}, 2, 'got 2 in b';
|
||||
|
||||
|
||||
$sql = "SELECT * FROM vtb WHERE b < 8 ORDER BY a DESC";
|
||||
$res = $dbh->selectall_arrayref($sql, {Slice => {}});
|
||||
is scalar(@$res), 2, "got 2 rows";
|
||||
is $res->[0]{a}, 4, 'got 4 in first a';
|
||||
is $res->[1]{a}, 1, 'got 1 in second a';
|
||||
|
||||
|
||||
$sql = "SELECT rowid FROM vtb WHERE c = 'six'";
|
||||
$res = $dbh->selectall_arrayref($sql, {Slice => {}});
|
||||
is_deeply $res, [{rowid => 2}], $sql;
|
||||
|
@ -56,14 +54,12 @@ $sql = "SELECT c FROM vtb WHERE c MATCH 'i' ORDER BY c";
|
|||
$res = $dbh->selectcol_arrayref($sql);
|
||||
is_deeply $res, [qw/nine six/], $sql;
|
||||
|
||||
|
||||
$dbh->do("INSERT INTO vtb(a, b, c) VALUES (11, 22, 33)");
|
||||
my $row_id = $dbh->last_insert_id('', '', '', '');
|
||||
is $row_id, 3, 'new rowid is 3';
|
||||
is scalar(@$perl_rows), 4, 'perl_rows expanded';
|
||||
is_deeply $perl_rows->[-1], [11, 22, 33], 'new row is correct';
|
||||
|
||||
|
||||
#======================================================================
|
||||
# test the hashref implementation
|
||||
#======================================================================
|
||||
|
@ -79,7 +75,6 @@ is scalar(@$res), 2, "got 2 rows";
|
|||
is $res->[0]{a}, 4, 'got 4 in first a';
|
||||
is $res->[1]{a}, 1, 'got 1 in second a';
|
||||
|
||||
|
||||
#======================================================================
|
||||
# test the colref implementation
|
||||
#======================================================================
|
||||
|
@ -104,7 +99,6 @@ $sql = "SELECT a FROM vtb WHERE a IN intarray";
|
|||
$res = $dbh->selectcol_arrayref($sql);
|
||||
is_deeply $res, [ 1, 7 ], "IN intarray";
|
||||
|
||||
|
||||
# same thing with strings
|
||||
our $strings = [qw/one two three/];
|
||||
ok $dbh->do(<<""), "create vtable strarray";
|
||||
|
|
|
@ -49,7 +49,6 @@ is $res->[0]{block}, $sigma_block, "letter in proper block";
|
|||
# the following does not work because \b gets escaped as a literal
|
||||
#$sql = "SELECT * FROM charinfo WHERE script='Greek' AND name MATCH '\\bSIGMA\\b'";
|
||||
|
||||
|
||||
# but the following does work because the REGEXP operator is handled
|
||||
# outside of the BEST_INDEX / FILTER methods
|
||||
$sql = "SELECT * FROM charinfo WHERE script='Greek' AND name REGEXP '\\bSIGMA\\b'";
|
||||
|
|
|
@ -18,7 +18,6 @@ my @interpolation_attempts = (
|
|||
'$self',
|
||||
);
|
||||
|
||||
|
||||
# sample data
|
||||
our $perl_rows = [
|
||||
[1, 2, 'three'],
|
||||
|
|
Loading…
Add table
Reference in a new issue