From 1814b1a0b78770c8ba9e7a0adef56c4c324d4064 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 26 Aug 2020 08:17:38 +0000 Subject: 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. --- t/over.t | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 't/over.t') diff --git a/t/over.t b/t/over.t index 8bf64ecb..6c4c8ee6 100644 --- a/t/over.t +++ b/t/over.t @@ -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'); } -- cgit v1.2.3-24-ge0c7