Pull merge.
[yaffs-website] / web / core / lib / Drupal / Core / Database / Driver / sqlite / Upsert.php
1 <?php
2
3 namespace Drupal\Core\Database\Driver\sqlite;
4
5 use Drupal\Core\Database\Query\Upsert as QueryUpsert;
6
7 /**
8  * SQLite implementation of \Drupal\Core\Database\Query\Upsert.
9  */
10 class Upsert extends QueryUpsert {
11
12   /**
13    * {@inheritdoc}
14    */
15   public function __toString() {
16     // Create a sanitized comment string to prepend to the query.
17     $comments = $this->connection->makeComment($this->comments);
18
19     // Default fields are always placed first for consistency.
20     $insert_fields = array_merge($this->defaultFields, $this->insertFields);
21
22     $query = $comments . 'INSERT OR REPLACE INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES ';
23
24     $values = $this->getInsertPlaceholderFragment($this->insertValues, $this->defaultFields);
25     $query .= implode(', ', $values);
26
27     return $query;
28   }
29
30 }