]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use getLengthExpression to measure field length instead of like
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 24 Mar 2022 10:12:12 +0000 (11:12 +0100)
committerVincent Petry (Rebase PR Action) <PVince81@users.noreply.github.com>
Thu, 24 Mar 2022 20:35:02 +0000 (20:35 +0000)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/user_ldap/lib/Migration/Version1120Date20210917155206.php

index d2b440c4dfe94e5bfc653e145a6fb12050019ee4..87a8f07fbe1229ff5075632271babbe76949080a 100644 (file)
@@ -127,9 +127,10 @@ class Version1120Date20210917155206 extends SimpleMigrationStep {
 
        protected function getSelectQuery(string $table): IQueryBuilder {
                $qb = $this->dbc->getQueryBuilder();
+               $lengthExpr = $this->dbc->getDatabasePlatform()->getLengthExpression('owncloud_name');
                $qb->select('owncloud_name', 'directory_uuid')
                        ->from($table)
-                       ->where($qb->expr()->like('owncloud_name', $qb->createNamedParameter(str_repeat('_', 65) . '%'), Types::STRING));
+                       ->where($qb->expr()->gt($qb->createFunction($lengthExpr), '64', IQueryBuilder::PARAM_INT));
                return $qb;
        }