Reply
Thread Tools
Posts: 19 | Thanked: 6 times | Joined on Dec 2012
#51
Hi,

As I test my theory on a duplicate db, I have to install sqlite3 ... but on test DB it seems to work properly !
here is the trigger :
Code:
CREATE TRIGGER UpdateIncommingBit
       AFTER INSERT ON mailmessages
       FOR EACH ROW
       WHEN 1|new.status <> new.status 
AND
128|new.status <> new.status 
AND
2048|new.status = new.status
BEGIN
    UPDATE mailmessages
       SET status = 1|status
     WHERE id = new.id;
END;
How to read it ?
cf : http://www.tutorialspoint.com/sqlite..._operators.htm

So I use bitwise opérator | to check if mail is read 128|new.status
"read" status is bitstatus 8 in mailstatusfalg table, bin 1000 0000 = dec 128
"new" status is bitstatus 12, bin 1000 0000 0000 = dec 2048
and so on (use windows calc in developper mode, option Dword, Déc) ...

so

1|new.status <> new.status = not "incoming" status
AND
128|new.status <> new.status = not "read" status
AND
2048|new.status = new.status = "new" status

if it's ok :

SET status = 1|status

my test process :

Code:
insert into mailmessages (id,type,parentfolderid,
previousparentfolderid,sender,
recipients,subject,stamp,status,parentaccountid,frommailbox,
mailfile,serveruid,size,contenttype,responseid,responsetype,
receivedstamp,copyserveruid,
restorefolderid,listid,rfcid,preview,parentthreadid)

values
(1500,8,14,0,'test0','test','test','2014-05-15',18496,8,'','','',123,4,0,0,'2014-05/15','',0,'','','',2016)
and with

Code:
values
(1501,8,14,0,'test1','test','test','2014-05-15',2048,8,'','','',123,4,0,0,'2014-05/15','',0,'','','',2016)
a select on these 2 records will return status 18497 and 2049

So now i just have to install sqlite3 and this trigger on y N9 and restart my own mail server (down since I change house) that produced this bug.

Let me know if it works for you ... I'll let you know as soon as possible

...
 

The Following User Says Thank You to nemric For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 18:38.