public Upsert::execute()
Runs the query against the database.
Return value
\Drupal\Core\Database\StatementInterface|null A prepared statement, or NULL if the query is not valid.
Overrides Query::execute
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\Query
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | public function execute() { if (! $this ->preExecute()) { return NULL; } $max_placeholder = 0; $values = array (); 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 = array (); return $last_insert_id ; } |
Please login to continue.