diff options
author | 2024-06-11 00:13:48 -0700 | |
---|---|---|
committer | 2024-06-11 00:13:48 -0700 | |
commit | a959a69a1dd781caa33829db161859c88455911d (patch) | |
tree | ac0db2fa23482c6ef5caedd21079bf2f8c9be368 /src/SemanticScuttle/Service/Bookmark.php | |
parent | 9bcc5827388491d37591a86a175f63fa9cd38d41 (diff) | |
parent | 85cca718e308779a56dbf302140ce9088fc0727a (diff) | |
download | scuttle-a959a69a1dd781caa33829db161859c88455911d.tar.gz scuttle-a959a69a1dd781caa33829db161859c88455911d.zip |
Merge branch 'sqlite-fixes' into oni
Diffstat (limited to 'src/SemanticScuttle/Service/Bookmark.php')
-rw-r--r-- | src/SemanticScuttle/Service/Bookmark.php | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/SemanticScuttle/Service/Bookmark.php b/src/SemanticScuttle/Service/Bookmark.php index 17f91b1..7eb1174 100644 --- a/src/SemanticScuttle/Service/Bookmark.php +++ b/src/SemanticScuttle/Service/Bookmark.php @@ -138,7 +138,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService if ($GLOBALS['enableVoting'] && $userservice->isLoggedOn()) { $cuid = $userservice->getCurrentUserId(); $vs = SemanticScuttle_Service_Factory::get('Vote'); - $query_1 .= ', !ISNULL(V.bId) as hasVoted, V.vote as vote'; + $query_1 .= ', ' . $this->db->QueryBuilder->isNotNull('V.bId') . ' as hasVoted, V.vote as vote'; $query_2 .= ' LEFT JOIN ' . $vs->getTableName() . ' AS V' . ' ON B.bId = V.bId' . ' AND V.uId = ' . (int)$cuid; @@ -549,7 +549,15 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService '', __LINE__, __FILE__, $sql, $this->db ); } - $this->db->sql_transaction('commit'); + + if (!$this->db->sql_transaction('commit')) { + $this->db->sql_transaction('rollback'); + message_die( + GENERAL_ERROR, + 'Could not commit bookmark', + '', __LINE__, __FILE__, $sql, $this->db + ); + } // Everything worked out, so return the new bookmark's bId. return $bId; @@ -653,7 +661,13 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService ); } - $this->db->sql_transaction('commit'); + if (!$this->db->sql_transaction('commit')) { + $this->db->sql_transaction('rollback'); + message_die( + GENERAL_ERROR, 'Could not commit bookmark update', + '', __LINE__, __FILE__, $sql, $this->db + ); + } // Everything worked out, so return true. return true; } @@ -789,7 +803,7 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService if ($GLOBALS['enableVoting'] && $userservice->isLoggedOn()) { $cuid = $userservice->getCurrentUserId(); $vs = SemanticScuttle_Service_Factory::get('Vote'); - $query_1 .= ', !ISNULL(V.bId) as hasVoted, V.vote as vote'; + $query_1 .= ', ' . $this->db->QueryBuilder->isNotNull('V.bId') . ' as hasVoted, V.vote as vote'; $query_2 .= ' LEFT JOIN ' . $vs->getTableName() . ' AS V' . ' ON B.bId = V.bId' . ' AND V.uId = ' . (int)$cuid; @@ -1003,7 +1017,13 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService ); } - $this->db->sql_transaction('commit'); + if (!$this->db->sql_transaction('commit')) { + $this->db->sql_transaction('rollback'); + message_die( + GENERAL_ERROR, 'Could not commit deleting votes for bookmark', + '', __LINE__, __FILE__, $query, $this->db + ); + } return true; } |