summaryrefslogtreecommitdiffstats
path: root/apps/encryption
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-08-10 16:21:41 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-08-10 16:21:41 +0200
commite6eb74958fd9779362fbde788cbfac982783abc0 (patch)
tree500b7b12008967002ea3f86ddd1e2ed9602ba76e /apps/encryption
parent5fea6f753e27939a693041288d46115154dac051 (diff)
downloadnextcloud-server-e6eb74958fd9779362fbde788cbfac982783abc0.tar.gz
nextcloud-server-e6eb74958fd9779362fbde788cbfac982783abc0.zip
Remove unnecessary DB prefixes from existing query builder usages
Diffstat (limited to 'apps/encryption')
-rw-r--r--apps/encryption/lib/migration.php6
-rw-r--r--apps/encryption/tests/lib/MigrationTest.php34
2 files changed, 20 insertions, 20 deletions
diff --git a/apps/encryption/lib/migration.php b/apps/encryption/lib/migration.php
index d22c571fd40..5396a7db627 100644
--- a/apps/encryption/lib/migration.php
+++ b/apps/encryption/lib/migration.php
@@ -72,7 +72,7 @@ class Migration {
// only update during the first run
if ($this->installedVersion !== '-1') {
$query = $this->connection->getQueryBuilder();
- $query->update('*PREFIX*filecache')
+ $query->update('filecache')
->set('size', 'unencrypted_size')
->where($query->expr()->eq('encrypted', $query->createParameter('encrypted')))
->setParameter('encrypted', 1);
@@ -163,7 +163,7 @@ class Migration {
$oldAppValues = $this->connection->getQueryBuilder();
$oldAppValues->select('*')
- ->from('*PREFIX*appconfig')
+ ->from('appconfig')
->where($oldAppValues->expr()->eq('appid', $oldAppValues->createParameter('appid')))
->setParameter('appid', 'files_encryption');
$appSettings = $oldAppValues->execute();
@@ -178,7 +178,7 @@ class Migration {
$oldPreferences = $this->connection->getQueryBuilder();
$oldPreferences->select('*')
- ->from('*PREFIX*preferences')
+ ->from('preferences')
->where($oldPreferences->expr()->eq('appid', $oldPreferences->createParameter('appid')))
->setParameter('appid', 'files_encryption');
$preferenceSettings = $oldPreferences->execute();
diff --git a/apps/encryption/tests/lib/MigrationTest.php b/apps/encryption/tests/lib/MigrationTest.php
index 5bc3b89b5b9..bb1f0a310a2 100644
--- a/apps/encryption/tests/lib/MigrationTest.php
+++ b/apps/encryption/tests/lib/MigrationTest.php
@@ -291,12 +291,12 @@ class MigrationTest extends \Test\TestCase {
/** @var \OCP\IDBConnection $connection */
$connection = \OC::$server->getDatabaseConnection();
$query = $connection->getQueryBuilder();
- $query->delete('*PREFIX*appconfig')
+ $query->delete('appconfig')
->where($query->expr()->eq('appid', $query->createParameter('appid')))
->setParameter('appid', 'encryption');
$query->execute();
$query = $connection->getQueryBuilder();
- $query->delete('*PREFIX*preferences')
+ $query->delete('preferences')
->where($query->expr()->eq('appid', $query->createParameter('appid')))
->setParameter('appid', 'encryption');
$query->execute();
@@ -309,10 +309,10 @@ class MigrationTest extends \Test\TestCase {
$this->invokePrivate($m, 'installedVersion', ['0.7']);
$m->updateDB();
- $this->verifyDB('*PREFIX*appconfig', 'files_encryption', 0);
- $this->verifyDB('*PREFIX*preferences', 'files_encryption', 0);
- $this->verifyDB('*PREFIX*appconfig', 'encryption', 3);
- $this->verifyDB('*PREFIX*preferences', 'encryption', 1);
+ $this->verifyDB('appconfig', 'files_encryption', 0);
+ $this->verifyDB('preferences', 'files_encryption', 0);
+ $this->verifyDB('appconfig', 'encryption', 3);
+ $this->verifyDB('preferences', 'encryption', 1);
}
@@ -329,17 +329,17 @@ class MigrationTest extends \Test\TestCase {
$this->invokePrivate($m, 'installedVersion', ['0.7']);
$m->updateDB();
- $this->verifyDB('*PREFIX*appconfig', 'files_encryption', 0);
- $this->verifyDB('*PREFIX*preferences', 'files_encryption', 0);
- $this->verifyDB('*PREFIX*appconfig', 'encryption', 3);
- $this->verifyDB('*PREFIX*preferences', 'encryption', 1);
+ $this->verifyDB('appconfig', 'files_encryption', 0);
+ $this->verifyDB('preferences', 'files_encryption', 0);
+ $this->verifyDB('appconfig', 'encryption', 3);
+ $this->verifyDB('preferences', 'encryption', 1);
// check if the existing values where overwritten correctly
/** @var \OC\DB\Connection $connection */
$connection = \OC::$server->getDatabaseConnection();
$query = $connection->getQueryBuilder();
$query->select('configvalue')
- ->from('*PREFIX*appconfig')
+ ->from('appconfig')
->where($query->expr()->andX(
$query->expr()->eq('appid', $query->createParameter('appid')),
$query->expr()->eq('configkey', $query->createParameter('configkey'))
@@ -353,7 +353,7 @@ class MigrationTest extends \Test\TestCase {
$query = $connection->getQueryBuilder();
$query->select('configvalue')
- ->from('*PREFIX*preferences')
+ ->from('preferences')
->where($query->expr()->andX(
$query->expr()->eq('appid', $query->createParameter('appid')),
$query->expr()->eq('configkey', $query->createParameter('configkey')),
@@ -399,7 +399,7 @@ class MigrationTest extends \Test\TestCase {
$connection = \OC::$server->getDatabaseConnection();
$query = $connection->getQueryBuilder();
$query->select('*')
- ->from('*PREFIX*filecache');
+ ->from('filecache');
$result = $query->execute();
$entries = $result->fetchAll();
foreach($entries as $entry) {
@@ -417,15 +417,15 @@ class MigrationTest extends \Test\TestCase {
/** @var \OCP\IDBConnection $connection */
$connection = \OC::$server->getDatabaseConnection();
$query = $connection->getQueryBuilder();
- $query->delete('*PREFIX*filecache');
+ $query->delete('filecache');
$query->execute();
$query = $connection->getQueryBuilder();
$result = $query->select('fileid')
- ->from('*PREFIX*filecache')
+ ->from('filecache')
->setMaxResults(1)->execute()->fetchAll();
$this->assertEmpty($result);
$query = $connection->getQueryBuilder();
- $query->insert('*PREFIX*filecache')
+ $query->insert('filecache')
->values(
array(
'storage' => $query->createParameter('storage'),
@@ -447,7 +447,7 @@ class MigrationTest extends \Test\TestCase {
}
$query = $connection->getQueryBuilder();
$result = $query->select('fileid')
- ->from('*PREFIX*filecache')
+ ->from('filecache')
->execute()->fetchAll();
$this->assertSame(19, count($result));
}