Skip to content

Commit d91ce32

Browse files
committed
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 <[email protected]>
1 parent fc6d354 commit d91ce32

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

apps/user_ldap/lib/Mapping/AbstractMapping.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,13 @@ protected function getXbyY($fetchCol, $compareCol, $search) {
139139
//having SQL injection at all.
140140
throw new \Exception('Invalid Column Name');
141141
}
142-
$query = $this->dbc->prepare('
143-
SELECT `' . $fetchCol . '`
144-
FROM `' . $this->getTableName() . '`
145-
WHERE `' . $compareCol . '` = ?
146-
');
142+
$qb = $this->dbc->getQueryBuilder();
143+
$qb->select($fetchCol)
144+
->from($this->getTableName())
145+
->where($qb->expr()->eq($compareCol, $qb->createNamedParameter($search)));
147146

148147
try {
149-
$res = $query->execute([$search]);
148+
$res = $qb->executeQuery();
150149
$data = $res->fetchOne();
151150
$res->closeCursor();
152151
return $data;

0 commit comments

Comments
 (0)