我可以信任mysql_insert_id()返回正确的值,多线程妄想症 [英] can I trust mysql_insert_id() to return correct value, multithreading paranoia
本文介绍了我可以信任mysql_insert_id()返回正确的值,多线程妄想症的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我制作了一个在表中插入新行的函数,在对mysql调用INSERT
语句后,我进行了一些检查,然后检查了mysql_insert_id()
的值.
I made a function that inserts a new line into a table, after calling an INSERT
statement into mysql, I then make some checks, and then I check the value of mysql_insert_id()
.
我想安静地知道在获得mysql_insert_id()
的结果之前,另一个线程不可能插入行插入.
I want to be quiet knowing that it is not possible for another thread to break in, inserting a row, before I get the result of mysql_insert_id()
.
我敢打赌,它应该很安全,但是我要问,因为这可能是灾难性的.
My bet is that it should be safe, but I am asking because this one can be disastrous.
推荐答案
查看全文