Skip to content

Commit

Permalink
Merge pull request #36453 from nextcloud/bugfix/noid/oci-longtext
Browse files Browse the repository at this point in the history
Fix MigrateBackgroundImages on oracle
  • Loading branch information
juliusknorr authored Jan 31, 2023
2 parents 3ff5683 + ecccff8 commit ca3f53a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/theming/lib/Jobs/MigrateBackgroundImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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;
Expand Down Expand Up @@ -92,7 +93,7 @@ protected function runPreparation(): void {
->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);
Expand Down
18 changes: 18 additions & 0 deletions tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,24 @@ public function testCastColumn(): void {
$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')
Expand Down

0 comments on commit ca3f53a

Please sign in to comment.