并行解释器/ db问题。交易没有修复。 [英] parallel interpreter/db problem. transaction didn't fix.

查看:55
本文介绍了并行解释器/ db问题。交易没有修复。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mysql_query(" START TRANSACTION&qu​​ot;,$ link2);

$ q2 = mysql_query(" SELECT pictures.pid AS pid

FROM pictures,counter

WHERE pictures.pid> counter.pid

LIMIT 1",$ link2);

if($ row2 = mysql_fetch_assoc($ q2)){

mysql_query(" UPDATE counter SET pid = $ row2 [pid]",$ link2);

$ n = $ row2 [''pid''];

} else {//到达表的末尾。

mysql_query(" UPDATE counter SET pid = 1",$ link2);

$ n = 1;

}

mysql_free_result($ q2);

mysql_query(" COMMIT",$ link2);


交易对结果没有影响。

我甚至试过锁定表格,但这只会导致无效

资源错误。

当这个图片代码按顺序被调用两次时,(2个单独的

解释器,可能是由不同的处理器),我得到相同的图像。我/ b $ b不应该两次获得相同的图像。这是那些

拉毛会议之一。


我尝试过的所有内容都会导致完全没有照片(图片

占位符)由于错误而具有相同的大小,或者在同一页面上具有相同的

图片。


交易,无交易,使用一个柜台是不可能的。

我不明白这里发生了什么。交易*应该*修复

这个!我错过了什么

mysql_query("START TRANSACTION", $link2);
$q2=mysql_query("SELECT pictures.pid AS pid
FROM pictures,counter
WHERE pictures.pid>counter.pid
LIMIT 1", $link2);
if ($row2=mysql_fetch_assoc($q2)) {
mysql_query("UPDATE counter SET pid=$row2[pid]", $link2);
$n=$row2[''pid''];
} else { //reached end of table.
mysql_query("UPDATE counter SET pid=1", $link2);
$n=1;
}
mysql_free_result($q2);
mysql_query("COMMIT", $link2);

the transaction makes no difference in the outcome.
I''ve even tried locking the tables, but that only results in invalid
resource errors.
when this picture code is called twice in sequence, (2 separate
interpreters, possibly by separate processors), I get the same image. I
shouldn''t be getting the same image twice. this is one of those
hair-pulling sessions.

Everything I''ve tried results either in no pictures at all (picture
placeholders) with both the same sizes due to errors, or with the same
pictures on the same page.

transactions, no transactions, using a counter is out of the question.
I don''t understand what''s even happening here. the transaction *should* fix
this! Am I missing something

推荐答案

link2);
link2);


q2 = mysql_query(" SELECT pictures.pid AS pid

FROM图片,柜台

WHERE pictures.pid> counter.pid

LIMIT 1",
q2=mysql_query("SELECT pictures.pid AS pid
FROM pictures,counter
WHERE pictures.pid>counter.pid
LIMIT 1",


link2);

if(
link2);
if (


这篇关于并行解释器/ db问题。交易没有修复。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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