Mercurial > hg > fapweb
changeset 520:6e9d03f10328
Add transactions to voting.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 08 Dec 2013 18:04:33 +0200 |
parents | 6aa9356ead52 |
children | bde31257ded5 |
files | usrajax.php |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/usrajax.php Sun Dec 08 17:43:52 2013 +0200 +++ b/usrajax.php Sun Dec 08 18:04:33 2013 +0200 @@ -81,6 +81,7 @@ array(CHK_RANGE, VT_INT, array($voteMin, $voteMax), "Invalid vote value."))) { // Check if the entry_id is actually valid + stExecSQL("BEGIN TRANSACTION"); $sql = stPrepareSQL("SELECT * FROM entries WHERE id=%d", $entry_id); if (($entry = stFetchSQL($sql)) !== false) { @@ -91,6 +92,7 @@ stUpdateVote($voteKeyId, $entry_id, $vote); } } + stExecSQL("COMMIT"); } break; @@ -99,6 +101,7 @@ stError("Voting is not enabled."); else { + stExecSQL("BEGIN TRANSACTION"); foreach (stExecSQL("SELECT * FROM compos WHERE visible<>0 AND voting<>0") as $compo) { $cid = $compo["id"]; @@ -112,6 +115,7 @@ } } } + stExecSQL("COMMIT"); if ($errorSet) {