Obey col length of 255 to insert and search in accounts_data

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2021-11-26 16:30:14 +01:00
parent d384edc9c6
commit 998144f832
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
1 changed files with 8 additions and 1 deletions

View File

@ -343,6 +343,10 @@ class AccountManager implements IAccountManager {
}
public function searchUsers(string $property, array $values): array {
// the value col is limited to 255 bytes. It is used for searches only.
$values = array_map(function (string $value) {
return Util::shortenMultibyteString($value, 255);
}, $values);
$chunks = array_chunk($values, 500);
$query = $this->connection->getQueryBuilder();
$query->select('*')
@ -625,8 +629,11 @@ class AccountManager implements IAccountManager {
continue;
}
// the value col is limited to 255 bytes. It is used for searches only.
$value = $property['value'] ? Util::shortenMultibyteString($property['value'], 255) : '';
$query->setParameter('name', $property['name'])
->setParameter('value', $property['value'] ?? '');
->setParameter('value', $value);
$query->executeStatement();
}
}