如果表行是由用户访问的,则对数据库中的其他用户隐藏表行

时间:2022-09-26 10:48:30

I have an table on which multiple records. if user(A) get record from table then others user can not get that record particular record that is retrieve by User(A) what should i do to reslove this

我有一个表,上面有多个记录。如果用户(A)从表中获取记录,那么其他用户就不能获得用户检索的特定记录(A)我该怎么做才能恢复这个记录

2 个解决方案

#1


0  

You can add a locked bool column to the table, to signify that the record is locked by some user. Rather than a bool, you can reference the user_id that has locked the row. You'll have to do this in your application code, since sql-server cannot do this work for you out of the box.

您可以添加一个锁定的bool列到表中,以表示记录被某些用户锁定。您可以引用已锁定行的user_id,而不是bool。您必须在应用程序代码中执行此操作,因为sql-server无法立即完成这项工作。

#2


0  

As i see in your comment,You can create new column or table to store id of user and flag accessed in that. While accessing records use this relationship.

正如我在您的评论中看到的,您可以创建新的列或表来存储在其中访问的用户id和标志。访问记录时使用此关系。

Or please elaborate your question and if possible provide an table structure

或者请详细说明你的问题,如果可能的话提供一个表格结构

#1


0  

You can add a locked bool column to the table, to signify that the record is locked by some user. Rather than a bool, you can reference the user_id that has locked the row. You'll have to do this in your application code, since sql-server cannot do this work for you out of the box.

您可以添加一个锁定的bool列到表中,以表示记录被某些用户锁定。您可以引用已锁定行的user_id,而不是bool。您必须在应用程序代码中执行此操作,因为sql-server无法立即完成这项工作。

#2


0  

As i see in your comment,You can create new column or table to store id of user and flag accessed in that. While accessing records use this relationship.

正如我在您的评论中看到的,您可以创建新的列或表来存储在其中访问的用户id和标志。访问记录时使用此关系。

Or please elaborate your question and if possible provide an table structure

或者请详细说明你的问题,如果可能的话提供一个表格结构