diff options
Diffstat (limited to 'inc/poche/Database.class.php')
-rw-r--r-- | inc/poche/Database.class.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index a89bce41..d95b9b81 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -289,4 +289,35 @@ class Database { | |||
289 | 289 | ||
290 | return $tags; | 290 | return $tags; |
291 | } | 291 | } |
292 | |||
293 | public function removeTagForEntry($entry_id, $tag_id) { | ||
294 | $sql_action = "DELETE FROM tags_entries WHERE tag_id=? AND entry_id=?"; | ||
295 | $params_action = array($tag_id, $entry_id); | ||
296 | $query = $this->executeQuery($sql_action, $params_action); | ||
297 | return $query; | ||
298 | } | ||
299 | |||
300 | public function retrieveTagByValue($value) { | ||
301 | $tag = NULL; | ||
302 | $sql = "SELECT * FROM tags WHERE value=?"; | ||
303 | $params = array($value); | ||
304 | $query = $this->executeQuery($sql, $params); | ||
305 | $tag = $query->fetchAll(); | ||
306 | |||
307 | return isset($tag[0]) ? $tag[0] : null; | ||
308 | } | ||
309 | |||
310 | public function createTag($value) { | ||
311 | $sql_action = 'INSERT INTO tags ( value ) VALUES (?)'; | ||
312 | $params_action = array($value); | ||
313 | $query = $this->executeQuery($sql_action, $params_action); | ||
314 | return $query; | ||
315 | } | ||
316 | |||
317 | public function setTagToEntry($tag_id, $entry_id) { | ||
318 | $sql_action = 'INSERT INTO tags_entries ( tag_id, entry_id ) VALUES (?, ?)'; | ||
319 | $params_action = array($tag_id, $entry_id); | ||
320 | $query = $this->executeQuery($sql_action, $params_action); | ||
321 | return $query; | ||
322 | } | ||
292 | } | 323 | } |