From c246edece6432e6a0f28f14ac93131e8439e4fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Sun, 29 Jan 2023 09:40:17 +0100 Subject: [PATCH 1/2] tests(oci): Test where statement on longtext column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl test: try with just passing the type to eq which should also cast Signed-off-by: Julius Härtl --- .../QueryBuilder/ExpressionBuilderDBTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php index 4a168cb0143..35d8b4faa34 100644 --- a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php @@ -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') From ecccff8bd232b579f08bc7fe387a5379cc6436cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 31 Jan 2023 10:19:35 +0100 Subject: [PATCH 2/2] fix(theming): Fix query for configvalue as CLOB on OCI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/theming/lib/Jobs/MigrateBackgroundImages.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/theming/lib/Jobs/MigrateBackgroundImages.php b/apps/theming/lib/Jobs/MigrateBackgroundImages.php index 97665d1179f..62179e46a4b 100644 --- a/apps/theming/lib/Jobs/MigrateBackgroundImages.php +++ b/apps/theming/lib/Jobs/MigrateBackgroundImages.php @@ -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);