MySQL是否具有等效的SQL Server rowversion? [英] Does MySQL have an equivalent of SQL Server rowversion?

查看:113
本文介绍了MySQL是否具有等效的SQL Server rowversion?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将SQL Server数据库架构迁移到MySQL. SQL Server上的某些表具有一列rowversion类型的列.这是一个整数值,该值在第一次插入该行时设置,然后在每次更新该行的任何列时再次设置.该数字只会递增.

I am migrating a SQL Server database schema over to MySQL. Some of the tables on SQL Server have a column of type rowversion. This is an integer value that is set when the row is first inserted and then again each time any column of the row is updated. The number is only ever incremented.

我们利用它来检查并发问题.因此,当插入插入服务器时,我们可以检查输入值是否与当前存储值不同.如果是这样,则自读取导致此行插入以来,该行已更新.然后,我们可以拒绝更新,因为它基于过期的值.乐观并发.

We make use of this to check for concurrency problems. So when an insert comes to the server we can check if the incoming value is different to the current stored value. If so, then the row has been updated since the read that has led to this insert. We can then reject the update because it is based on out of date values. Optimistic concurrency.

在MySQL中是否有对我们一样的东西?

Is there an equivalent that will do the same for us in MySQL?

推荐答案

MySQL TIMESTAMP数据类型具有乐观并发测试所需的自动初始化和自动更新功能.例如,参见 http://www.mysqltutorial.org/mysql-timestamp.aspx

The MySQL TIMESTAMP data type has the auto initialize and auto update features needed for optimistic concurrency tests. See, for example, http://www.mysqltutorial.org/mysql-timestamp.aspx

这篇关于MySQL是否具有等效的SQL Server rowversion?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆