如何处理交易? [英] How to handle Transactions ?

查看:96
本文介绍了如何处理交易?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在多用户网络场景中,我有一个工作注册表格,其中生成了唯一的workId.如果多个用户点击相同的注册表.表格如何处理交易?表示如何为此设置数据库锁.

如果我将数据库锁放在要插入的表上,则它可能会起作用.

但是,如果用户在该表上进行更新,而另一个用户在该表上进行更新,那怎么办?

请问对此有解决方案吗?概率法则确保唯一性?我本人将使用GUID.


In web, multi-user scenario, I have a work registration form where a unique workId is generated. If multi-users hit for the same reg. form how to handle transaction ?? means how to put database lock for it.

If i put database lock on a table for inserts it may work.

But if a user does an update on that table and if another does an update on that table then how ???

Pls have a solution for this ?

解决方案

Why not just make the WorkID either autoincremented (nasty) and let the database itself ensure the uniqueness, or a GUID, and then the laws of probability ensure uniqueness? I would use GUIDs, myself.


这篇关于如何处理交易?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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