Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,22 +201,35 @@ public function setValue($app, $key, $value) {

$sql = $this->conn->getQueryBuilder();
$sql->update('appconfig')
->set('configvalue', $sql->createParameter('configvalue'))
->where($sql->expr()->eq('appid', $sql->createParameter('app')))
->andWhere($sql->expr()->eq('configkey', $sql->createParameter('configkey')))
->setParameter('configvalue', $value)
->setParameter('app', $app)
->setParameter('configkey', $key);
->set('configvalue', $sql->createNamedParameter($value))
->where($sql->expr()->eq('appid', $sql->createNamedParameter($app)))
->andWhere($sql->expr()->eq('configkey', $sql->createNamedParameter($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 OracleConnection)) {
// Only update the value when it is not the same
$sql->andWhere($sql->expr()->neq('configvalue', $sql->createParameter('configvalue')))
->setParameter('configvalue', $value);

/*
* Only update the value when it is not the same
* Note that NULL requires some special handling. Since comparing
* against null can have special results.
*/

if ($value === null) {
$sql->andWhere(
$sql->expr()->isNotNull('configvalue')
);
} else {
$sql->andWhere(
$sql->expr()->orX(
$sql->expr()->isNull('configvalue'),
$sql->expr()->neq('configvalue', $sql->createNamedParameter($value))
)
);
}
}

$changedRow = (bool) $sql->execute();
Expand Down