aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Database.class.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-12-06 15:07:51 +0100
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-12-06 15:07:51 +0100
commitc432fa1674fbe2b190cf0d0bab2e90302a61e98f (patch)
tree731e876604ece7f35cebdb8a9e80f5b520f21b75 /inc/poche/Database.class.php
parentf778e47283c9691d2992045e0fbcdfc6685f157f (diff)
downloadwallabag-c432fa1674fbe2b190cf0d0bab2e90302a61e98f.tar.gz
wallabag-c432fa1674fbe2b190cf0d0bab2e90302a61e98f.tar.zst
wallabag-c432fa1674fbe2b190cf0d0bab2e90302a61e98f.zip
[add] assign and remove a tag to an entry
Diffstat (limited to 'inc/poche/Database.class.php')
-rw-r--r--inc/poche/Database.class.php31
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}