List:General Discussion« Previous MessageNext Message »
From:Stefan Onken Date:November 4 2009 7:28pm
Subject:trigger
View as plain text  
Hello,

I am new to using triggers in mysql. I am using mysql 5.1.37  and would 
like to setup a trigger like:

CREATE TRIGGER greylist AFTER INSERT on greylist
delete from greylist where first_seen < NOW()-60*60*24*5;
END;

When typing this into mysql I am getting an error. Where is my mistake?


mysql> show fields from greylist;
+---------------+---------------+------+-----+---------+
| Field         | Type          | Null | Key | Default |
+---------------+---------------+------+-----+---------+
| id            | int(11)       | NO   | PRI | NULL    |
| SenderIP      | varchar(15)   | NO   | MUL | NULL    |
| SenderAddress | varchar(1024) | NO   | MUL | NULL    |
| first_seen    | int(11)       | NO   |     | NULL    |
+---------------+---------------+------+-----+---------+
4 rows in set (0,00 sec)

I would like to archive that after every insert in the greylist table I 
am purging the oldest xx records.

Stefan



www.stonki.de : My, myself and I
www.kbarcode.net : barcode solution for KDE
www.krename.net : renamer for KDE
www.proftpd.de : a FTP server...
Thread
triggerStefan Onken4 Nov
  • Re: triggerMichael Dykman4 Nov
  • Re: triggerPhil4 Nov
    • RE: triggerGavin Towey4 Nov
      • Re: triggerStefan Onken5 Nov
  • RE: triggerGavin Towey4 Nov
    • Re: triggerPhil5 Nov