diff options
| author | Guilhem Moulin <guilhem@fripost.org> | 2015-07-26 06:56:04 +0200 | 
|---|---|---|
| committer | Guilhem Moulin <guilhem@fripost.org> | 2015-07-26 06:56:04 +0200 | 
| commit | 14e5d6b258c79b5982aafb804fdeeac35a21598c (patch) | |
| tree | aa609e55805d2aa0e5403d8cb0d6bad75e39be90 | |
| parent | 4f46df9b18a9b3577e85a6682119d6f4b7d7f782 (diff) | |
Check return value after a SQL UPDATE.
| -rwxr-xr-x | imapsync | 18 | 
1 files changed, 12 insertions, 6 deletions
| @@ -337,7 +337,8 @@ sub sync_tree($$%) {                  # $missing's $mbx2, which is not in the database and                  # doesn't exist on $exists                  msg($exists, "Rename mailbox $mbx to $mbx2[0]"); -                $sth->{rename}->execute($mbx2[0],$idx); +                $sth->{rename}->execute($mbx2[0],$idx) or +                    msg('database', "WARNING: Can't rename $mbx to $mbx2[0]");                  $IMAP->{$exists}->{client}->rename($mbx, $mbx2[0]);                  $DBH->commit();                  mv_tree($IMAP->{$exists}->{mailboxes}, $mbx, $mbx2[0], %children); @@ -375,7 +376,8 @@ sub sync_tree($$%) {                  # database as associated with $mbx2, which exists on                  # $missing but not on $exists                  msg($missing, "Rename mailbox $mbx2 to $mbx"); -                $sth->{rename}->execute($mbx,$idx); +                $sth->{rename}->execute($mbx,$idx) or +                    msg('database', "WARNING: Can't rename $mbx2 to $mbx2");                  $IMAP->{$missing}->{client}->rename($mbx2, $mbx);                  $DBH->commit();                  mv_tree($IMAP->{$missing}->{mailboxes}, $mbx2, $mbx, %children); @@ -992,8 +994,10 @@ sub sync_messages($$;$$) {      # don't store the new UIDNEXTs before to avoid downloading these      # mails again in the event of a crash -    $STH_UPDATE_LOCAL->execute($lIMAP->get_cache( qw/UIDNEXT HIGHESTMODSEQ/), $idx); -    $STH_UPDATE_REMOTE->execute($rIMAP->get_cache(qw/UIDNEXT HIGHESTMODSEQ/), $idx); +    $STH_UPDATE_LOCAL->execute($lIMAP->get_cache( qw/UIDNEXT HIGHESTMODSEQ/), $idx) or +        msg('database', "WARNING: Can't update remote UIDNEXT/HIGHESTMODSEQ for $mailbox"); +    $STH_UPDATE_REMOTE->execute($rIMAP->get_cache(qw/UIDNEXT HIGHESTMODSEQ/), $idx) or +        msg('database', "WARNING: Can't update remote UIDNEXT/HIGHESTMODSEQ for $mailbox");      $DBH->commit();  } @@ -1139,8 +1143,10 @@ while(1) {              elsif (sync_known_messages($IDX, $MAILBOX)) {                  # sync updates to known messages before fetching new messages                  # get_cache is safe after pull_update -                $STH_UPDATE_LOCAL_HIGHESTMODSEQ->execute( $lIMAP->get_cache('HIGHESTMODSEQ'), $IDX); -                $STH_UPDATE_REMOTE_HIGHESTMODSEQ->execute($rIMAP->get_cache('HIGHESTMODSEQ'), $IDX); +                $STH_UPDATE_LOCAL_HIGHESTMODSEQ->execute( $lIMAP->get_cache('HIGHESTMODSEQ'), $IDX) and +                    msg('database', "WARNING: Can't update local HIGHESTMODSEQ for $MAILBOX"); +                $STH_UPDATE_REMOTE_HIGHESTMODSEQ->execute($rIMAP->get_cache('HIGHESTMODSEQ'), $IDX) or +                    msg('database', "WARNING: Can't update remote HIGHESTMODSEQ for $MAILBOX");                  $DBH->commit();              }              sync_messages($IDX, $MAILBOX); | 
