]> source.dussan.org Git - nextcloud-server.git/commitdiff
add missing backticks all over the place
authorJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 10 Jun 2013 07:53:29 +0000 (09:53 +0200)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Fri, 14 Jun 2013 11:04:23 +0000 (13:04 +0200)
Conflicts:
apps/files_encryption/lib/util.php
lib/files/cache/backgroundwatcher.php
lib/files/cache/cache.php

apps/files_encryption/lib/util.php
lib/files/cache/cache.php
lib/public/share.php
tests/lib/db.php

index f62ec359306a095736401f9853225ee62d4f58b0..b4b3923a799ef95250a5a330bc5caaf19939f53c 100644 (file)
@@ -292,7 +292,7 @@ class Util {
         */
        public function recoveryEnabledForUser() {
 
-               $sql = 'SELECT `recovery_enabled` FROM `*PREFIX*encryption` WHERE  uid = ?';
+               $sql = 'SELECT `recovery_enabled` FROM `*PREFIX*encryption` WHERE `uid` = ?';
 
                $args = array($this->userId);
 
@@ -350,7 +350,7 @@ class Util {
                        // Create a new record instead
                } else {
 
-                       $sql = 'UPDATE `*PREFIX*encryption` SET recovery_enabled = ? WHERE uid = ?';
+                       $sql = 'UPDATE `*PREFIX*encryption` SET `recovery_enabled` = ? WHERE `uid` = ?';
 
                        $args = array(
                                $enabled,
@@ -1105,7 +1105,7 @@ class Util {
         */
        public function getMigrationStatus() {
 
-               $sql = 'SELECT `migration_status` FROM `*PREFIX*encryption`  WHERE uid = ?';
+               $sql = 'SELECT `migration_status` FROM `*PREFIX*encryption` WHERE `uid` = ?';
 
                $args = array($this->userId);
 
index 5cc60da672c987633da34169f194393f6590557e..4f1f8b6fbc1a0daaac862049cb0ac7bbac7d86c3 100644 (file)
@@ -153,7 +153,7 @@ class Cache {
                if ($fileId > -1) {
                        $query = \OC_DB::prepare(
                                'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `unencrypted_size` , `etag`
-                                FROM `*PREFIX*filecache` WHERE parent = ? ORDER BY `name` ASC');
+                                FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC');
                        $result = $query->execute(array($fileId));
                        $files = $result->fetchAll();
                        foreach ($files as &$file) {
@@ -224,7 +224,7 @@ class Cache {
                $params[] = $id;
 
                $query = \OC_DB::prepare('UPDATE `*PREFIX*filecache` SET ' . implode(' = ?, ', $queryParts) . '=?'
-                       . ' WHERE fileid = ?');
+                       . ' WHERE `fileid` = ?');
                $query->execute($params);
        }
 
@@ -356,10 +356,10 @@ class Cache {
         * remove all entries for files that are stored on the storage from the cache
         */
        public function clear() {
-               $query = \OC_DB::prepare('DELETE FROM `*PREFIX*filecache` WHERE storage = ?');
+               $query = \OC_DB::prepare('DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?');
                $query->execute(array($this->numericId));
 
-               $query = \OC_DB::prepare('DELETE FROM `*PREFIX*storages` WHERE id = ?');
+               $query = \OC_DB::prepare('DELETE FROM `*PREFIX*storages` WHERE `id` = ?');
                $query->execute(array($this->storageId));
        }
 
index b015d6f255163378012a1ff5dd5583a68445fc8b..d1b8516318c71e866799249fafe840b600abe3eb 100644 (file)
@@ -153,11 +153,11 @@ class Share {
 
                        // Fetch all shares of this file path from DB
                        $query = \OC_DB::prepare(
-                               'SELECT share_with
+                               'SELECT `share_with`
                                FROM
                                `*PREFIX*share`
                                WHERE
-                               item_source = ? AND share_type = ?'
+                               `item_source` = ? AND `share_type` = ?'
                        );
 
                        $result = $query->execute(array($source, self::SHARE_TYPE_USER));
@@ -172,11 +172,11 @@ class Share {
                        // We also need to take group shares into account
 
                        $query = \OC_DB::prepare(
-                               'SELECT share_with
+                               'SELECT `share_with`
                                FROM
                                `*PREFIX*share`
                                WHERE
-                               item_source = ? AND share_type = ?'
+                               `item_source` = ? AND `share_type` = ?'
                        );
 
                        $result = $query->execute(array($source, self::SHARE_TYPE_GROUP));
@@ -193,11 +193,11 @@ class Share {
                        //check for public link shares
                        if (!$publicShare) {
                                $query = \OC_DB::prepare(
-                                       'SELECT share_with
+                                       'SELECT `share_with`
                                        FROM
                                        `*PREFIX*share`
                                        WHERE
-                                       item_source = ? AND share_type = ?'
+                                       `item_source` = ? AND `share_type` = ?'
                                );
 
                                $result = $query->execute(array($source, self::SHARE_TYPE_LINK));
index d6626bc25610bdb1411694194eb74187b96d6f33..7b2a5e309f0151f1588bcf207f42ec1c3bdf4438 100644 (file)
@@ -33,15 +33,15 @@ class Test_DB extends PHPUnit_Framework_TestCase {
        }
 
        public function testQuotes() {
-               $query = OC_DB::prepare('SELECT `fullname` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
+               $query = OC_DB::prepare('SELECT `fullname` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array('uri_1'));
                $this->assertTrue((bool)$result);
                $row = $result->fetchRow();
                $this->assertFalse($row);
-               $query = OC_DB::prepare('INSERT INTO *PREFIX*'.$this->table2.' (`fullname`,`uri`) VALUES (?,?)');
+               $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)');
                $result = $query->execute(array('fullname test', 'uri_1'));
                $this->assertTrue((bool)$result);
-               $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
+               $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array('uri_1'));
                $this->assertTrue((bool)$result);
                $row = $result->fetchRow();
@@ -52,19 +52,19 @@ class Test_DB extends PHPUnit_Framework_TestCase {
        }
 
        public function testNOW() {
-               $query = OC_DB::prepare('INSERT INTO *PREFIX*'.$this->table2.' (`fullname`,`uri`) VALUES (NOW(),?)');
+               $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (NOW(),?)');
                $result = $query->execute(array('uri_2'));
                $this->assertTrue((bool)$result);
-               $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
+               $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array('uri_2'));
                $this->assertTrue((bool)$result);
        }
 
        public function testUNIX_TIMESTAMP() {
-               $query = OC_DB::prepare('INSERT INTO *PREFIX*'.$this->table2.' (`fullname`,`uri`) VALUES (UNIX_TIMESTAMP(),?)');
+               $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (UNIX_TIMESTAMP(),?)');
                $result = $query->execute(array('uri_3'));
                $this->assertTrue((bool)$result);
-               $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
+               $query = OC_DB::prepare('SELECT `fullname`,`uri` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array('uri_3'));
                $this->assertTrue((bool)$result);
        }
@@ -88,7 +88,7 @@ class Test_DB extends PHPUnit_Framework_TestCase {
                        $this->assertTrue((bool)$result);
                }
 
-               $query = OC_DB::prepare('SELECT * FROM *PREFIX*'.$this->table3);
+               $query = OC_DB::prepare('SELECT * FROM `*PREFIX*'.$this->table3.'`');
                $result = $query->execute();
                $this->assertTrue((bool)$result);
                $this->assertEquals('4', $result->numRows());
@@ -100,10 +100,10 @@ class Test_DB extends PHPUnit_Framework_TestCase {
                $carddata = 'This is a vCard';
 
                // Normal test to have same known data inserted.
-               $query = OC_DB::prepare('INSERT INTO *PREFIX*'.$this->table2.' (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)');
+               $query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)');
                $result = $query->execute(array($fullname, $uri, $carddata));
                $this->assertTrue((bool)$result);
-               $query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
+               $query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array($uri));
                $this->assertTrue((bool)$result);
                $row = $result->fetchRow();
@@ -119,7 +119,7 @@ class Test_DB extends PHPUnit_Framework_TestCase {
                        ));
                $this->assertTrue((bool)$result);
 
-               $query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
+               $query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM `*PREFIX*'.$this->table2.'` WHERE `uri` = ?');
                $result = $query->execute(array($uri));
                $this->assertTrue((bool)$result);
                $row = $result->fetchRow();