Merge pull request #36453 from nextcloud/bugfix/noid/oci-longtext

Fix MigrateBackgroundImages on oracle
This commit is contained in:
Julius Härtl 2023-01-31 15:27:19 +01:00 committed by GitHub
commit ca3f53ab88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View file

@ -30,6 +30,7 @@ use OCA\Theming\AppInfo\Application;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\QueuedJob;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\AppData\IAppDataFactory;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
@ -92,7 +93,7 @@ class MigrateBackgroundImages extends QueuedJob {
->from('preferences')
->where($selector->expr()->eq('appid', $selector->createNamedParameter('theming')))
->andWhere($selector->expr()->eq('configkey', $selector->createNamedParameter('background')))
->andWhere($selector->expr()->eq('configvalue', $selector->createNamedParameter('custom')))
->andWhere($selector->expr()->eq('configvalue', $selector->createNamedParameter('custom', IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR))
->executeQuery();
$userIds = $result->fetchAll(\PDO::FETCH_COLUMN);

View file

@ -132,6 +132,24 @@ class ExpressionBuilderDBTest extends TestCase {
$this->assertEquals(1, $result);
}
public function testLongText(): void {
$appId = $this->getUniqueID('testing');
$this->createConfig($appId, 'mykey', 'myvalue');
$query = $this->connection->getQueryBuilder();
$query->select('*')
->from('appconfig')
->where($query->expr()->eq('appid', $query->createNamedParameter($appId)))
->andWhere($query->expr()->eq('configkey', $query->createNamedParameter('mykey')))
->andWhere($query->expr()->eq('configvalue', $query->createNamedParameter('myvalue', IQueryBuilder::PARAM_STR), IQueryBuilder::PARAM_STR));
$result = $query->executeQuery();
$entries = $result->fetchAll();
$result->closeCursor();
self::assertCount(1, $entries);
self::assertEquals('myvalue', $entries[0]['configvalue']);
}
protected function createConfig($appId, $key, $value) {
$query = $this->connection->getQueryBuilder();
$query->insert('appconfig')