[Mono-list] MySql triggering an event in C#
Peter Hagen
peter at wingsofdeath.nu
Sat Sep 20 07:49:06 EDT 2008
Hi
you could read out the modification date of the table with an sql
statement. This is really easy in mysql. I use it to cache a table
and re-read on alteration. Thats not very CPU heavy. Its no problem
to read the modification time every second. Do a statement like:
SHOW TABLE STATUS like 'tablename';
and then you have to find the update field:
if (dr.Read())
{
if (dr["Update_time"] != null || dr["Update_time"] !=
System.DBNull.Value) {
result = (DateTime) dr["Update_time"];
}
}
You could also have a file system watch on the mysql table file. Not
sure which one you should try, but thats not realy hard to find out :)
cheers
Peter
On Sep 18, 2008, at 10:03 AM, cmare wrote:
>
> 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
> --
> View this message in context: http://www.nabble.com/MySql-
> triggering-an-event-in-C--tp19547971p19547971.html
> Sent from the Mono - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
More information about the Mono-list
mailing list