Skip to content

Commit

Permalink
fix sql quotation of identifiers
Browse files Browse the repository at this point in the history
# Conflicts:
#	Services/Database/classes/PDO/class.ilDBPdo.php
  • Loading branch information
iszmais authored and chfsx committed Sep 6, 2023
1 parent cefa9c9 commit c166bd0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Services/Database/classes/PDO/class.ilDBPdo.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

declare(strict_types=1);
/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -17,6 +16,7 @@
*
*********************************************************************/

declare(strict_types=1);
/**
* Class pdoDB
* @author Oskar Truffer <[email protected]>
Expand Down Expand Up @@ -500,13 +500,13 @@ public function update(string $table_name, array $columns, array $where): int
$q = "UPDATE " . $this->quoteIdentifier($table_name) . " SET ";
$lim = "";
foreach ($fields as $k => $field) {
$q .= $lim . $field . " = " . $placeholders_full[$k];
$q .= $lim . $this->quoteIdentifier($field) . " = " . $placeholders_full[$k];
$lim = ", ";
}
$q .= " WHERE ";
$lim = "";
foreach ($where as $k => $col) {
$q .= $lim . $k . " = " . $this->quote($col[1], $col[0]);
$q .= $lim . $this->quoteIdentifier($k) . " = " . $this->quote($col[1], $col[0]);
$lim = " AND ";
}

Expand All @@ -531,7 +531,7 @@ public function update(string $table_name, array $columns, array $where): int
$q .= " WHERE ";
$lim = "";
foreach (array_keys($where) as $k) {
$q .= $lim . $k . " = %s";
$q .= $lim . $this->quoteIdentifier($k) . " = %s";
$lim = " AND ";
}

Expand Down Expand Up @@ -846,7 +846,7 @@ public function replace(string $table, array $primary_keys, array $other_columns
$values = [];

foreach ($a_columns as $k => $col) {
$fields[] = $k;
$fields[] = $this->quoteIdentifier($k);
$placeholders[] = "%s";
$placeholders2[] = ":$k";
$types[] = $col[0];
Expand Down

0 comments on commit c166bd0

Please sign in to comment.