diff options
author | Kondou <kondou@ts.unde.re> | 2013-03-30 09:15:05 +0400 |
---|---|---|
committer | Kondou <kondou@ts.unde.re> | 2013-03-30 09:15:05 +0400 |
commit | 15439b353e0c98b8e861615fef4dfe96cd8ada9b (patch) | |
tree | 3c4c5a7dd2fd374e76defe603bc4fda916d27078 /reader | |
parent | e2d8ca405f1982e84af7322118b26a5689ae1e97 (diff) |
Proper SQL-Queries for reader app.
Using backticks instead of nothing now.
Diffstat (limited to 'reader')
-rwxr-xr-x | reader/lib/tag_utils.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/reader/lib/tag_utils.php b/reader/lib/tag_utils.php index 7d77a3feb..dd6aa474b 100755 --- a/reader/lib/tag_utils.php +++ b/reader/lib/tag_utils.php @@ -1,6 +1,6 @@ <?php function find_tags_for_ebook($path_of_ebook) { - $sql = 'SELECT tags FROM *PREFIX*eBook_library WHERE filepath = ?'; + $sql = 'SELECT `tags` FROM `*PREFIX*eBook_library` WHERE `filepath` = ?'; $stmt = OCP\DB::prepare($sql); $res = $stmt->execute(array($path_of_ebook)); $tags = NULL; @@ -14,7 +14,7 @@ function update_tag_for_ebook($new_tag,$path_of_ebook) { $tags = find_tags_for_ebook($path_of_ebook); $each_tag = explode(",",$tags); if (count($each_tag) < 5) { - $stmt = OCP\DB::prepare("UPDATE *PREFIX*eBook_library SET tags = ? WHERE filepath = ?"); + $stmt = OCP\DB::prepare("UPDATE `*PREFIX*eBook_library` SET `tags` = ? WHERE `filepath` = ?"); $stmt->execute(array($new_tag,$path_of_ebook)); } else @@ -22,12 +22,12 @@ function update_tag_for_ebook($new_tag,$path_of_ebook) { } function insert_new_tag($new_tag,$path_of_ebook) { - $stmt = OCP\DB::prepare('INSERT INTO *PREFIX*eBook_library (filepath,tags) VALUES (?, ?)'); + $stmt = OCP\DB::prepare('INSERT INTO `*PREFIX*eBook_library` (`filepath`,`tags`) VALUES (?, ?)'); $stmt->execute(array($path_of_ebook,$new_tag)); } function find_results_with_tag_like($tag) { - $sql = 'SELECT * FROM *PREFIX*eBook_library WHERE tags LIKE ?'; + $sql = 'SELECT * FROM `*PREFIX*eBook_library` WHERE `tags` LIKE ?'; $stmt = OCP\DB::prepare($sql); $res = $stmt->execute(array($tag)); return $res; @@ -38,7 +38,7 @@ function check_consistency_with_database($root,$pdfs) { foreach ($pdfs as $pdf) { $new_array_pdfs[] = $root.$pdf; } - $sql = 'SELECT filepath from *PREFIX*ebook_library'; + $sql = 'SELECT `filepath` from `*PREFIX*ebook_library`'; $stmt = OCP\DB::prepare($sql); $res = $stmt->execute(); while ($r = $res->fetchRow()) { @@ -48,7 +48,7 @@ function check_consistency_with_database($root,$pdfs) { } function delete_entry($filepath) { - $sql = 'DELETE FROM *PREFIX*eBook_library WHERE filepath = ?'; + $sql = 'DELETE FROM `*PREFIX*eBook_library` WHERE filepath = ?'; $stmt = OCP\DB::prepare($sql); $res = $stmt->execute(array($filepath)); } |