diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-14 17:59:52 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-14 17:59:52 +0200 |
commit | fb9e75edb6d01729a27c84f6f11399a1b0fde9f3 (patch) | |
tree | e10cc5ba04beecae732e907e65051dae2e95cdda | |
parent | 4a777d686bd1bffb32ab6a52d479fe3a7bb33c4f (diff) | |
parent | 2d0f0e898dfe36d1c2d4919b772a0c886317274b (diff) | |
download | nextcloud-server-fb9e75edb6d01729a27c84f6f11399a1b0fde9f3.tar.gz nextcloud-server-fb9e75edb6d01729a27c84f6f11399a1b0fde9f3.zip |
Merge pull request #18973 from owncloud/try-fixing-app-config-on-oracle
Do not compare the value on Oracle
-rw-r--r-- | lib/private/appconfig.php | 16 | ||||
-rw-r--r-- | tests/lib/appconfig.php | 10 |
2 files changed, 21 insertions, 5 deletions
diff --git a/lib/private/appconfig.php b/lib/private/appconfig.php index 7ee64980fd0..cf2a057f224 100644 --- a/lib/private/appconfig.php +++ b/lib/private/appconfig.php @@ -175,11 +175,21 @@ class AppConfig implements IAppConfig { ->set('configvalue', $sql->createParameter('configvalue')) ->where($sql->expr()->eq('appid', $sql->createParameter('app'))) ->andWhere($sql->expr()->eq('configkey', $sql->createParameter('configkey'))) - ->andWhere($sql->expr()->neq('configvalue', $sql->createParameter('configvalue'))) ->setParameter('configvalue', $value) ->setParameter('app', $app) - ->setParameter('configkey', $key) - ->setParameter('configvalue', $value); + ->setParameter('configkey', $key); + + /* + * Only limit to the existing value for non-Oracle DBs: + * http://docs.oracle.com/cd/E11882_01/server.112/e26088/conditions002.htm#i1033286 + * > Large objects (LOBs) are not supported in comparison conditions. + */ + if (!($this->conn instanceof \OC\DB\OracleConnection)) { + // Only update the value when it is not the same + $sql->andWhere($sql->expr()->neq('configvalue', $sql->createParameter('configvalue'))) + ->setParameter('configvalue', $value); + } + $changedRow = (bool) $sql->execute(); $this->cache[$app][$key] = $value; diff --git a/tests/lib/appconfig.php b/tests/lib/appconfig.php index 5ea446aee51..98420abe7bc 100644 --- a/tests/lib/appconfig.php +++ b/tests/lib/appconfig.php @@ -191,7 +191,10 @@ class AppConfig extends TestCase { $this->assertEquals('1.2.3', $config->getValue('testapp', 'installed_version')); $this->assertConfigKey('testapp', 'installed_version', '1.2.3'); - $this->assertFalse($config->setValue('testapp', 'installed_version', '1.2.3')); + $wasModified = $config->setValue('testapp', 'installed_version', '1.2.3'); + if (!(\OC::$server->getDatabaseConnection() instanceof \OC\DB\OracleConnection)) { + $this->assertFalse($wasModified); + } $this->assertEquals('1.2.3', $config->getValue('testapp', 'installed_version')); $this->assertConfigKey('testapp', 'installed_version', '1.2.3'); @@ -218,7 +221,10 @@ class AppConfig extends TestCase { $this->assertEquals('somevalue', $config->getValue('someapp', 'somekey')); $this->assertConfigKey('someapp', 'somekey', 'somevalue'); - $this->assertFalse($config->setValue('someapp', 'somekey', 'somevalue')); + $wasInserted = $config->setValue('someapp', 'somekey', 'somevalue'); + if (!(\OC::$server->getDatabaseConnection() instanceof \OC\DB\OracleConnection)) { + $this->assertFalse($wasInserted); + } } public function testDeleteKey() { |