ccache_update: protect insert with transaction block

This commit is contained in:
Andrew Dolgov 2009-03-06 18:09:55 +03:00
parent 2d5718ae58
commit c205bb8d15

View file

@ -5861,6 +5861,8 @@
$unread = (int) getFeedArticles($link, $feed_id, $is_cat, true, $owner_uid); $unread = (int) getFeedArticles($link, $feed_id, $is_cat, true, $owner_uid);
} }
db_query($link, "BEGIN");
$result = db_query($link, "SELECT feed_id FROM $table $result = db_query($link, "SELECT feed_id FROM $table
WHERE owner_uid = '$owner_uid' AND feed_id = '$feed_id' LIMIT 1"); WHERE owner_uid = '$owner_uid' AND feed_id = '$feed_id' LIMIT 1");
@ -5876,6 +5878,8 @@
($feed_id, $unread, $owner_uid, NOW())"); ($feed_id, $unread, $owner_uid, NOW())");
} }
db_query($link, "COMMIT");
if ($feed_id > 0 && $prev_unread != $unread) { if ($feed_id > 0 && $prev_unread != $unread) {
if (!$is_cat) { if (!$is_cat) {