3 namespace Drupal\Core\Database\Driver\sqlite;
5 use Drupal\Core\Database\Query\Upsert as QueryUpsert;
8 * SQLite implementation of \Drupal\Core\Database\Query\Upsert.
10 class Upsert extends QueryUpsert {
15 public function __toString() {
16 // Create a sanitized comment string to prepend to the query.
17 $comments = $this->connection->makeComment($this->comments);
19 // Default fields are always placed first for consistency.
20 $insert_fields = array_merge($this->defaultFields, $this->insertFields);
22 $query = $comments . 'INSERT OR REPLACE INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES ';
24 $values = $this->getInsertPlaceholderFragment($this->insertValues, $this->defaultFields);
25 $query .= implode(', ', $values);