]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiMailSync.pm
www_stream: note existence of IMAP and NNTP URLs
[public-inbox.git] / lib / PublicInbox / LeiMailSync.pm
index 275e0cc4c433ce6b27fa43ee86984b5147885d6f..5a10c127c1f8e2db1c080f20530ed90385c3d461 100644 (file)
@@ -32,9 +32,7 @@ sub new {
        bless { filename => $f, fmap => {} }, $cls;
 }
 
-sub lms_commit { delete($_[0]->{dbh})->commit }
-
-sub lms_begin { ($_[0]->{dbh} //= dbh_new($_[0], 1))->begin_work };
+sub lms_write_prepare { ($_[0]->{dbh} //= dbh_new($_[0], 1)) };
 
 sub create_tables {
        my ($dbh) = @_;
@@ -118,7 +116,7 @@ EOM
 }
 
 sub set_src {
-       my ($self, $oidhex, $folder, $id) = @_;
+       my ($self, $oidbin, $folder, $id) = @_;
        my $fid = $self->{fmap}->{$folder} //= fid_for($self, $folder, 1);
        my $sth;
        if (ref($id)) { # scalar name
@@ -131,7 +129,7 @@ INSERT OR IGNORE INTO blob2name (oidbin, fid, name) VALUES (?, ?, ?)
 INSERT OR IGNORE INTO blob2num (oidbin, fid, uid) VALUES (?, ?, ?)
 
        }
-       $sth->execute(pack('H*', $oidhex), $fid, $id);
+       $sth->execute($oidbin, $fid, $id);
 }
 
 sub clear_src {
@@ -468,14 +466,4 @@ sub imap_oid {
        $oidbin ? unpack('H*', $oidbin) : undef;
 }
 
-# FIXED? something with "lei <up|q>" is causing uncommitted transaction
-# TODO: remove soon
-sub DESTROY {
-       my ($self) = @_;
-       my $dbh = delete($self->{dbh}) or return;
-       return if $dbh->{ReadOnly};
-       undef $dbh;
-       warn "BUG $$ $0 $self {dbh} OPEN ppid=".getppid.' '.Carp::longmess();
-}
-
 1;