X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/ac1820e72ec14b31fc751fb2482a0d31caed21ba..a18093425a78a5b46f3d95809c757f8e6e66eb89:/procmail/msgid-index diff --git a/procmail/msgid-index b/procmail/msgid-index index 0f300a2..caccf83 100644 --- a/procmail/msgid-index +++ b/procmail/msgid-index @@ -1,5 +1,5 @@ # create table messages (sender text not null, recipient text not null, -# subject text not null, msgid text unique not null, filename text primary key +# subject text not null, msgid text not null, filename text primary key # not null unique, timestamp integer, dest text not null); # # create trigger insert_messages_timestamp after insert on messages begin @@ -14,10 +14,9 @@ DATA="$FROM,$NL$ORIGINAL_TO,$NL$SUBJECT,$NL$MSGID" INCLUDERC=$PMDIR/sql-escape QUERY="insert into messages (sender, recipient, subject, msgid, filename, dest) values ( - $DATA, '\\'$THISLOGFILE_REL\\'', '\\'\$DESTFILE\\''); - select * from messages where filename = '\\'$THISLOGFILE_REL\\''" -TRAP="$TRAP; case \"$($DO_QUERY '$QUERY')\" in '') - echo 'msgid-index: failed to insert reference into database';; esac" + $DATA, '$THISLOGFILE_REL', '\$DESTFILE');" +TRAP="$TRAP; OUT=\"$(echo \"$QUERY\" | $DO_QUERY 2>&1)\"; + [ -n \"\$OUT\" ] && echo \"msgid-index: failed to insert reference into database: \$OUT\"" QUERY DATA