Skip to content

How to MySql trigger an event in C#

Marko

Asked Sep 18, 2008, 12:10 AM EDT1 answer
Share
LinkedInX
Hello.

I wandering if you maybe have an idea how to do that:

I'm working with C# in mono and MySql on a ubuntu platform. I would like to have an table with some colons in MySql. When something is written in the table, it should trigger an event in C# and delete the record in MySql.

Have can I do that? Should I set up an timer and then read from the MySql or is there an better way. I really don't want to use to much of CPU.

Thank's 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    if mysql and c# in same machine, use trigger like this pattern:

    DELIMITER $$
    CREATE TRIGGER tg1 AFTER INSERT ON `testme9`
    FOR EACH ROW
    BEGIN
    \! php "/tmp/debug.php" >> /tmp/yourlog.txt
    END $$
    DELIMITER ;

    if not, calling web service in debug.php
    0