MySql 中的 @@DBTS
大家好,我想问一下MySql中是否有相当于@@DBTS TSQL全局变量的变量(我需要访问整个数据库中已访问的最后一行的时间戳,而不仅仅是一个表)。
我需要这个,因为我正在尝试使用 Microsoft Sync Framework 和 MySql 进行双向同步。
任何帮助都感激不尽。 谢谢。
Hey guys, I want to ask if there is an equivalent to the @@DBTS TSQL global variable in MySql (I need to access the timestamp of the last row that has been accessed in the whole database, not just one table).
I need this because I'm trying to use Microsoft Sync Framework and MySql for bi-directional syncing.
Any help will be much appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,您可以获得的最接近的是这样的查询:
INFORMATION_SCHEMA 数据库包含数据库中所有表的属性的多个表。
WHERE UPDATE_TIME <的原因 NOW()
子句的特点是,只需运行该查询,就会导致 MySQL 更新 INFORMATION_SCHEMA 中的一些表,因此如果没有WHERE
子句,您将总是只获取当前时间。显然,如果你的 MySQL 数据库真的很忙,所以所有表基本上每秒都会更新,那么这个查询将不起作用,但在这种情况下,你最好尽可能频繁地同步,因为你知道会有修改。
The closest you can get, as far as I know, is a query like this:
The
INFORMATION_SCHEMA
database holds several tables of attributes of all tables in the database. The reason for theWHERE UPDATE_TIME < NOW()
clause is that simply by running that query, you cause MySQL to update some of the tables inINFORMATION_SCHEMA
, so without theWHERE
clause you'd always just get the current time.Obviously, if your MySQL database is really busy, so that all tables are updated basically every second, this query won't work, but in that case you might as well just sync as often as possible because you know there'll be modifications.