Commit 638f25e6 authored by catch's avatar catch
Browse files

Issue #3152415 by Lal_, rik-dev, Matroskeen, daffie: Bracket-encapsulated...

Issue #3152415 by Lal_, rik-dev, Matroskeen, daffie: Bracket-encapsulated field names for static queries in core/lib/Drupal/Core
parent 09733138
Loading
Loading
Loading
Loading
+1 −1
Changes for core/lib/Drupal/Core/Batch/BatchStorage.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public function load($id) {
    // Ensure that a session is started before using the CSRF token generator.
    $this->session->start();
    try {
      $batch = $this->connection->query("SELECT batch FROM {batch} WHERE bid = :bid AND token = :token", [
      $batch = $this->connection->query("SELECT [batch] FROM {batch} WHERE [bid] = :bid AND [token] = :token", [
        ':bid' => $id,
        ':token' => $this->csrfToken->get($id),
      ])->fetchField();
+1 −1
Changes for core/lib/Drupal/Core/Cache/DatabaseBackend.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) {
    // ::select() is a much smaller proportion of the request.
    $result = [];
    try {
      $result = $this->connection->query('SELECT cid, data, created, expire, serialized, tags, checksum FROM {' . $this->connection->escapeTable($this->bin) . '} WHERE cid IN ( :cids[] ) ORDER BY cid', [':cids[]' => array_keys($cid_mapping)]);
      $result = $this->connection->query('SELECT [cid], [data], [created], [expire], [serialized], [tags], [checksum] FROM {' . $this->connection->escapeTable($this->bin) . '} WHERE [cid] IN ( :cids[] ) ORDER BY [cid]', [':cids[]' => array_keys($cid_mapping)]);
    }
    catch (\Exception $e) {
      // Nothing to do.
+1 −1
Changes for core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ protected function doInvalidateTags(array $tags) {
   */
  protected function getTagInvalidationCounts(array $tags) {
    try {
      return $this->connection->query('SELECT tag, invalidations FROM {cachetags} WHERE tag IN ( :tags[] )', [':tags[]' => $tags])
      return $this->connection->query('SELECT [tag], [invalidations] FROM {cachetags} WHERE [tag] IN ( :tags[] )', [':tags[]' => $tags])
        ->fetchAllKeyed();
    }
    catch (\Exception $e) {
+4 −4
Changes for core/lib/Drupal/Core/Config/DatabaseStorage.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ public function __construct(Connection $connection, $table, array $options = [],
   */
  public function exists($name) {
    try {
      return (bool) $this->connection->queryRange('SELECT 1 FROM {' . $this->connection->escapeTable($this->table) . '} WHERE collection = :collection AND name = :name', 0, 1, [
      return (bool) $this->connection->queryRange('SELECT 1 FROM {' . $this->connection->escapeTable($this->table) . '} WHERE [collection] = :collection AND [name] = :name', 0, 1, [
        ':collection' => $this->collection,
        ':name' => $name,
      ], $this->options)->fetchField();
@@ -84,7 +84,7 @@ public function exists($name) {
  public function read($name) {
    $data = FALSE;
    try {
      $raw = $this->connection->query('SELECT data FROM {' . $this->connection->escapeTable($this->table) . '} WHERE collection = :collection AND name = :name', [':collection' => $this->collection, ':name' => $name], $this->options)->fetchField();
      $raw = $this->connection->query('SELECT [data] FROM {' . $this->connection->escapeTable($this->table) . '} WHERE [collection] = :collection AND [name] = :name', [':collection' => $this->collection, ':name' => $name], $this->options)->fetchField();
      if ($raw !== FALSE) {
        $data = $this->decode($raw);
      }
@@ -102,7 +102,7 @@ public function read($name) {
  public function readMultiple(array $names) {
    $list = [];
    try {
      $list = $this->connection->query('SELECT name, data FROM {' . $this->connection->escapeTable($this->table) . '} WHERE collection = :collection AND name IN ( :names[] )', [':collection' => $this->collection, ':names[]' => $names], $this->options)->fetchAllKeyed();
      $list = $this->connection->query('SELECT [name], [data] FROM {' . $this->connection->escapeTable($this->table) . '} WHERE [collection] = :collection AND [name] IN ( :names[] )', [':collection' => $this->collection, ':names[]' => $names], $this->options)->fetchAllKeyed();
      foreach ($list as &$data) {
        $data = $this->decode($data);
      }
@@ -318,7 +318,7 @@ public function getCollectionName() {
   */
  public function getAllCollectionNames() {
    try {
      return $this->connection->query('SELECT DISTINCT collection FROM {' . $this->connection->escapeTable($this->table) . '} WHERE collection <> :collection ORDER by collection', [
      return $this->connection->query('SELECT DISTINCT [collection] FROM {' . $this->connection->escapeTable($this->table) . '} WHERE [collection] <> :collection ORDER by [collection]', [
          ':collection' => StorageInterface::DEFAULT_COLLECTION,
        ]
      )->fetchCol();
+1 −1
Changes for core/lib/Drupal/Core/Extension/module.api.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -660,7 +660,7 @@ function hook_update_N(&$sandbox) {
    // This must be the first run. Initialize the sandbox.
    $sandbox['progress'] = 0;
    $sandbox['current_pk'] = 0;
    $sandbox['max'] = Database::getConnection()->query('SELECT COUNT(myprimarykey) FROM {mytable1}')->fetchField();
    $sandbox['max'] = Database::getConnection()->query('SELECT COUNT([myprimarykey]) FROM {mytable1}')->fetchField();
  }

  // Update in chunks of 20.
Loading