Merge pull request #18973 from owncloud/try-fixing-app-config-on-oracle

Do not compare the value on Oracle
This commit is contained in:
Thomas Müller 2015-09-14 17:59:52 +02:00
commit fb9e75edb6
2 changed files with 21 additions and 5 deletions

View File

@ -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('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;

View File

@ -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() {