]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/OverIdx.pm
www: rework async_* to use method table
[public-inbox.git] / lib / PublicInbox / OverIdx.pm
index c57be7243a59356a3c18691f318207b0e062ca91..5821c562b814de635862db755db1c7a42f9954e8 100644 (file)
@@ -12,7 +12,7 @@ use strict;
 use warnings;
 use base qw(PublicInbox::Over);
 use IO::Handle;
-use DBI;
+use DBI qw(:sql_types); # SQL_BLOB
 use PublicInbox::MID qw/id_compress mids_for_index references/;
 use PublicInbox::Smsg qw(subject_normalized);
 use Compress::Zlib qw(compress);
@@ -21,7 +21,7 @@ use Carp qw(croak);
 
 sub dbh_new {
        my ($self) = @_;
-       my $dbh = $self->SUPER::dbh_new(1);
+       my $dbh = $self->SUPER::dbh_new($self->{-no_sync} ? 2 : 1);
 
        # TRUNCATE reduces I/O compared to the default (DELETE)
        # We do not use WAL since we're optimized for read-only ops,
@@ -337,7 +337,7 @@ VALUES (?,?,?,?,?,?)
        my $n = 0;
        my @v = ($num, $tid, $sid, $ts, $ds);
        foreach (@v) { $sth->bind_param(++$n, $_) }
-       $sth->bind_param(++$n, $ddd);
+       $sth->bind_param(++$n, $ddd, SQL_BLOB);
        $sth->execute;
        $sth = $dbh->prepare_cached(<<'');
 INSERT INTO id2num (id, num) VALUES (?,?)