mirror of
https://github.com/nextcloud/server.git
synced 2026-04-25 08:08:33 -04:00
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:
parent
155b75027c
commit
49f1c3f00e
1 changed files with 5 additions and 6 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue