From 980d59332e0f8208dcb27a7b4f754e41158c7dc3 Mon Sep 17 00:00:00 2001 From: uckelman Date: Sun, 11 Apr 2010 12:54:04 +0000 Subject: Added setMessageIdIfAbsent(). git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6639 67b53d14-2c14-4ace-a08f-0dab2b34000c --- src/Bridge.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/Bridge.php b/src/Bridge.php index ad3b6c3..537fb5c 100644 --- a/src/Bridge.php +++ b/src/Bridge.php @@ -53,6 +53,14 @@ class Bridge { return $row['forum_id']; } + public function setMessageIdIfAbsent($messageId) { + $sql = 'INSERT IGNORE INTO posts (message_id) VALUES (' . + $this->db->quote($messageId) . ')'; + + $count = $this->db->exec($sql); + return $count == 1; + } + protected function get_exactly_one_row($sql) { $result = $this->db->query($sql); -- cgit v1.2.3