vc轮询mysql,使用C#轮询方法监视mysql数据库和表更新

Monitoring mysql database and table updates using C# polling method

I need to monitor MySql database and log the delete, update, etc. operations done or not?

I have many tables in my Myhr database, but want to create a console application, which monitor Myhr db and check if there is any update or deletion is done. If yes, then it must return that value(the operation done).

Code samples will be of great use.

解决方案This is not really a question, it more a list of requirements and you asking for some code so save you trying to do it. I suggest that you read the FAQ on how to ask questions on this forum as it will guide you towards asking questions that you are more likely to get solutions to.

As for your problem, what about using Triggers on the database.

Mysql Triggers[^]

You could set up a trigger on every table in your database to update a log table with any changes. Personally I think it is over kill to have to monitor EVERY table.

But without knowing your database design it is not easy to advise. I also cannot see a reason for needing this sort of monitoring?

An alternative to the triggers, is that each time your application saves data, it writes an entry to the log table and you just poll the log table on a regular basis to see if there are new entries. Again, this removes the need to monitor every table but just monitor 1.

This sounds like a disaster in the making, the first question that come to mind is WHY.

If MySQL supports triggers then insert the changes into a log table and query the log table.

We use this to keep and audit of changes but I would never consider polling the table. We allow the user to query the log table based on a bunch of criteria.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值