function Upsert::execute
Same name in this branch
- 8.9.x core/lib/Drupal/Core/Database/Driver/pgsql/Upsert.php \Drupal\Core\Database\Driver\pgsql\Upsert::execute()
Same name in other branches
- 9 core/modules/pgsql/src/Driver/Database/pgsql/Upsert.php \Drupal\pgsql\Driver\Database\pgsql\Upsert::execute()
- 9 core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/Upsert.php \Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses\Upsert::execute()
- 9 core/lib/Drupal/Core/Database/Query/Upsert.php \Drupal\Core\Database\Query\Upsert::execute()
- 10 core/modules/pgsql/src/Driver/Database/pgsql/Upsert.php \Drupal\pgsql\Driver\Database\pgsql\Upsert::execute()
- 10 core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/Upsert.php \Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses\Upsert::execute()
- 10 core/lib/Drupal/Core/Database/Query/Upsert.php \Drupal\Core\Database\Query\Upsert::execute()
- 11.x core/modules/pgsql/src/Driver/Database/pgsql/Upsert.php \Drupal\pgsql\Driver\Database\pgsql\Upsert::execute()
- 11.x core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/Upsert.php \Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses\Upsert::execute()
- 11.x core/lib/Drupal/Core/Database/Query/Upsert.php \Drupal\Core\Database\Query\Upsert::execute()
Overrides Query::execute
2 methods override Upsert::execute()
- NativeUpsert::execute in core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ NativeUpsert.php - Runs the query against the database.
- Upsert::execute in core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Upsert.php - Runs the query against the database.
File
-
core/
lib/ Drupal/ Core/ Database/ Query/ Upsert.php, line 93
Class
- Upsert
- General class for an abstracted "Upsert" (UPDATE or INSERT) query operation.
Namespace
Drupal\Core\Database\QueryCode
public function execute() {
if (!$this->preExecute()) {
return NULL;
}
$max_placeholder = 0;
$values = [];
foreach ($this->insertValues as $insert_values) {
foreach ($insert_values as $value) {
$values[':db_insert_placeholder_' . $max_placeholder++] = $value;
}
}
$last_insert_id = $this->connection
->query((string) $this, $values, $this->queryOptions);
// Re-initialize the values array so that we can re-use this query.
$this->insertValues = [];
return $last_insert_id;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.