From 1d718ace9e7c9e65fedca5dc3f7396d41ea44005 Mon Sep 17 00:00:00 2001 From: uckelman Date: Fri, 30 Apr 2010 17:26:15 +0000 Subject: Added removePost() for post deletion. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6790 67b53d14-2c14-4ace-a08f-0dab2b34000c --- src/Bridge.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Bridge.php') diff --git a/src/Bridge.php b/src/Bridge.php index d9f0dec..b137b51 100644 --- a/src/Bridge.php +++ b/src/Bridge.php @@ -126,6 +126,18 @@ class Bridge { } } + public function removePost($postId) { + throw_if_null($postId); + + $sql = 'DELETE FROM posts WHERE post_id = ' . $postId; + + $count = $this->db->exec($sql); + + if ($count < 1) { + throw new Exception('Failed to delete post id: ' . $postId); + } + } + protected function get_exactly_one_row($sql) { $result = $this->db->query($sql); -- cgit v1.2.3