refactor(LDAP): switch from prepares statement to query builder

- has the advantage that queries will be reported in the query.log when
  configured

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2025-10-15 18:45:08 +02:00
parent 155b75027c
commit 49f1c3f00e
No known key found for this signature in database
GPG key ID: 7424F1874854DF23

View file

@ -139,14 +139,13 @@ abstract class AbstractMapping {
//having SQL injection at all.
throw new \Exception('Invalid Column Name');
}
$query = $this->dbc->prepare('
SELECT `' . $fetchCol . '`
FROM `' . $this->getTableName() . '`
WHERE `' . $compareCol . '` = ?
');
$qb = $this->dbc->getQueryBuilder();
$qb->select($fetchCol)
->from($this->getTableName())
->where($qb->expr()->eq($compareCol, $qb->createNamedParameter($search)));
try {
$res = $query->execute([$search]);
$res = $qb->executeQuery();
$data = $res->fetchOne();
$res->closeCursor();
return $data;