aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Database.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Database.class.php')
-rwxr-xr-xinc/poche/Database.class.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 6244df88..036c9d1b 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -77,7 +77,7 @@ class Database {
77 } 77 }
78 else { 78 else {
79 $sql = ' 79 $sql = '
80 CREATE TABLE tags ( 80 CREATE TABLE IF NOT EXISTS tags (
81 id bigserial primary key, 81 id bigserial primary key,
82 value varchar(255) NOT NULL 82 value varchar(255) NOT NULL
83 ); 83 );
@@ -110,7 +110,7 @@ class Database {
110 } 110 }
111 else { 111 else {
112 $sql = ' 112 $sql = '
113 CREATE TABLE tags_entries ( 113 CREATE TABLE IF NOT EXISTS tags_entries (
114 id bigserial primary key, 114 id bigserial primary key,
115 entry_id integer NOT NULL, 115 entry_id integer NOT NULL,
116 tag_id integer NOT NULL 116 tag_id integer NOT NULL
@@ -245,7 +245,7 @@ class Database {
245 $sql_limit = "LIMIT ".$limit." OFFSET 0"; 245 $sql_limit = "LIMIT ".$limit." OFFSET 0";
246 } 246 }
247 247
248 $sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND user_id=? ORDER BY id " . $sql_limit; 248 $sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=? ORDER BY id " . $sql_limit;
249 $query = $this->executeQuery($sql, array($user_id)); 249 $query = $this->executeQuery($sql, array($user_id));
250 $entries = $query->fetchAll(); 250 $entries = $query->fetchAll();
251 251
@@ -253,7 +253,7 @@ class Database {
253 } 253 }
254 254
255 public function retrieveUnfetchedEntriesCount($user_id) { 255 public function retrieveUnfetchedEntriesCount($user_id) {
256 $sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND user_id=?"; 256 $sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=?";
257 $query = $this->executeQuery($sql, array($user_id)); 257 $query = $this->executeQuery($sql, array($user_id));
258 list($count) = $query->fetch(); 258 list($count) = $query->fetch();
259 259
@@ -374,7 +374,7 @@ class Database {
374 $id = null; 374 $id = null;
375 } 375 }
376 else { 376 else {
377 $id = intval($this->getLastId( (STORAGE == 'postgres') ? 'users_id_seq' : '' )); 377 $id = intval($this->getLastId( (STORAGE == 'postgres') ? 'entries_id_seq' : '') );
378 } 378 }
379 return $id; 379 return $id;
380 } 380 }
@@ -407,7 +407,7 @@ class Database {
407 public function getLastId($column = '') { 407 public function getLastId($column = '') {
408 return $this->getHandle()->lastInsertId($column); 408 return $this->getHandle()->lastInsertId($column);
409 } 409 }
410 410
411 public function search($term, $user_id, $limit = '') { 411 public function search($term, $user_id, $limit = '') {
412 $search = '%'.$term.'%'; 412 $search = '%'.$term.'%';
413 $sql_action = "SELECT * FROM entries WHERE user_id=? AND (content LIKE ? OR title LIKE ? OR url LIKE ?) "; //searches in content, title and URL 413 $sql_action = "SELECT * FROM entries WHERE user_id=? AND (content LIKE ? OR title LIKE ? OR url LIKE ?) "; //searches in content, title and URL