Commit 6565f129 by pupi1985

Turned REPLACE statements into INSERT..ON DUPLICATE KEY UPDATE in db/post-update.php

parent 4b4df9e2
......@@ -351,8 +351,14 @@
Update the cached count of the number of flagged posts in the database
*/
{
if (qa_should_update_counts())
qa_db_query_sub("REPLACE ^options (title, content) SELECT 'cache_flaggedcount', COUNT(*) FROM ^posts WHERE flagcount>0 AND type IN ('Q', 'A', 'C')");
if (qa_should_update_counts()) {
qa_db_query_sub(
"INSERT INTO ^options (title, content) " .
"SELECT 'cache_flaggedcount', COUNT(*) FROM ^posts " .
"WHERE flagcount > 0 AND type IN ('Q', 'A', 'C') " .
"ON DUPLICATE KEY UPDATE content = VALUES(content)"
);
}
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment