# HG changeset patch # User Matti Hamalainen # Date 1386518673 -7200 # Node ID 6e9d03f103282dcfcdbc13c31dcb954898649edb # Parent 6aa9356ead52254e29cf513655bc5ce0a4abe8a5 Add transactions to voting. diff -r 6aa9356ead52 -r 6e9d03f10328 usrajax.php --- 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) {