]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/poche/Database.class.php
Create sqlite table tags_entries only if not already exists
[github/wallabag/wallabag.git] / inc / poche / Database.class.php
index afe02a41e955a66e34bebf59f37129df76fd7539..04731821fb3311a6cd0e6180bfe5d8bc4ec9ebdb 100644 (file)
@@ -81,7 +81,7 @@ class Database {
 
         if (STORAGE == 'sqlite') {
             $sql = '
-                CREATE TABLE tags_entries (
+                CREATE TABLE IF NOT EXISTS tags_entries (
                     id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE,
                     entry_id INTEGER,
                     tag_id INTEGER,
@@ -337,7 +337,7 @@ class Database {
 
     public function retrieveEntriesByTag($tag_id) {
         $sql = 
-            "SELECT * FROM entries
+            "SELECT entries.* FROM entries
             LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id
             WHERE tags_entries.tag_id = ?";
         $query = $this->executeQuery($sql, array($tag_id));
@@ -348,7 +348,7 @@ class Database {
 
     public function retrieveTagsByEntry($entry_id) {
         $sql = 
-            "SELECT * FROM tags
+            "SELECT tags.* FROM tags
             LEFT JOIN tags_entries ON tags_entries.tag_id=tags.id
             WHERE tags_entries.entry_id = ?";
         $query = $this->executeQuery($sql, array($entry_id));