File: rt_97598_crash_on_disconnect_with_virtual_tables.t

package info (click to toggle)
libdbd-sqlite3-perl 1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,004 kB
  • sloc: ansic: 167,715; perl: 1,788; pascal: 277; makefile: 9
file content (38 lines) | stat: -rw-r--r-- 934 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More;
use if -d ".git", "Test::FailWarnings";

BEGIN { requires_sqlite('3.7.7') }
BEGIN { plan skip_all => 'FTS is disabled for this DBD::SQLite' unless has_fts() }

my $dbh = connect_ok(AutoCommit => 0);

$dbh->do($_) for (
  'CREATE VIRTUAL TABLE test_fts USING fts4 (
     col1,
     col2,
  )',
  'INSERT INTO test_fts (col1, col2) VALUES ("abc", "123")',
  'INSERT INTO test_fts (col1, col2) VALUES ("def", "456")',
  'INSERT INTO test_fts (col1, col2) VALUES ("abc", "123")',
  'INSERT INTO test_fts (col1, col2) VALUES ("def", "456")',
  'INSERT INTO test_fts (col1, col2) VALUES ("abc", "123")',
);

my $sth = $dbh->prepare('SELECT * FROM test_fts WHERE col2 MATCh "123"');
$sth->execute;

while ( my @row = $sth->fetchrow_array ) {
   note join " ", @row;
}
#$sth->finish;

$dbh->commit;
$dbh->disconnect;

pass "all done without segfault";

done_testing;