开发者

PHP & MySQL: Check if table's data has changed without polling?

Is there a way to test if a MySQL table's data has changed at all, without connecting or querying.

This might sound weird, but in ASP.NET you can set up SqlDependencies that are kind of events that occur when data is chan开发者_运维百科ged (so you don't have to poll your database).


Might not fit your solution (especially if the writer to the db is not in the same application space as the reader) but what if on insert, you set some application wide variable to a Last updated value.
Which avoids you polling the db directly, although, there may still be some polling of the application for that value.


you can use a UDF inside of a trigger to send a message through a socket. if you can not develop your own udf then maybe a combination of sys_exec and telnet will do the trick.

  • http://bernardodamele.blogspot.ch/2009/01/command-execution-with-mysql-udf.html
  • http://www.php.net/manual/de/function.socket-create.php

but be careful and do a good exception handling i.e. socket timout.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜