diff options
author | Eric Wong <e@yhbt.net> | 2020-08-26 08:17:38 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-08-27 10:57:24 +0000 |
commit | 1814b1a0b78770c8ba9e7a0adef56c4c324d4064 (patch) | |
tree | 8bf80366cc71b199f9a99a4cc5cb6a0d8d223dff /t/over.t | |
parent | 71a27b7f45140194566e945ee7957e81abbc67bf (diff) | |
download | public-inbox-1814b1a0b78770c8ba9e7a0adef56c4c324d4064.tar.gz |
over: rename ->connect method to ->dbh
`->connect' is confused with the perlfunc for the `connect(2)' syscall, and also `DBI->connect'. Since SQLite doesn't use sockets, the word "connect" needlessly confuses me. Give it a short name to match the field name we use for it, which also matches the variable name used by the DBI(3pm) and DBD::SQLite(3pm) manpages.
Diffstat (limited to 't/over.t')
-rw-r--r-- | t/over.t | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -9,7 +9,7 @@ require_mods('DBD::SQLite'); use_ok 'PublicInbox::OverIdx'; my ($tmpdir, $for_destroy) = tmpdir(); my $over = PublicInbox::OverIdx->new("$tmpdir/over.sqlite3"); -$over->connect; +$over->dbh; # open file is($over->max, 0, 'max is zero on new DB (scalar context)'); is_deeply([$over->max], [0], 'max is zero on new DB (list context)'); my $x = $over->next_tid; @@ -26,11 +26,10 @@ ok(!$over->{dbh}->{ReadOnly}, 'OverIdx is not ReadOnly'); $over->disconnect; $over = PublicInbox::Over->new("$tmpdir/over.sqlite3"); -$over->connect; -ok($over->{dbh}->{ReadOnly}, 'Over is ReadOnly'); +ok($over->dbh->{ReadOnly}, 'Over is ReadOnly'); $over = PublicInbox::OverIdx->new("$tmpdir/over.sqlite3"); -$over->connect; +$over->dbh; is($over->sid('hello-world'), $x, 'idempotent across reopen'); $over->each_by_mid('never', sub { fail('should not be called') }); @@ -71,7 +70,7 @@ SKIP: { skip("no WAL in SQLite version $v < 3.7.0", 1) if $v lt v3.7.0; $over->{dbh}->do('PRAGMA journal_mode = WAL'); $over = PublicInbox::OverIdx->new("$tmpdir/over.sqlite3"); - is($over->connect->selectrow_array('PRAGMA journal_mode'), 'wal', + is($over->dbh->selectrow_array('PRAGMA journal_mode'), 'wal', 'WAL journal_mode not clobbered if manually set'); } |