本文介绍了是否存在UPDATE count = count + 1的并发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,我会遇到任何并发问题吗?

I wanted to know, will I run into any concurrency problem with this?

这不在交易中。该代码用于 Sqlite(prototype),但我计划将其与MySql或MS的SQL一起使用

This is NOT in a transaction. This code is for Sqlite(prototype), but I plan to use it with either MySql or a SQL from MS

                command.CommandText =
                    "UPDATE tag_name SET count = count+1 "+
                    "WHERE tagid=@tagid";
                command.Parameters.Add("@tagid", DbType.Int64).Value = tagId;
                command.ExecuteNonQuery();


推荐答案

不,这不是问题。默认情况下,锁定机制应处理单个语句中的任何并发问题。

No this shouldn't be a problem. By default the locking mechanism should take care of any concurrency issues in single statements.

这篇关于是否存在UPDATE count = count + 1的并发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 10:10