diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Upsert.php b/core/lib/Drupal/Core/Database/Driver/mysql/Upsert.php index 2230f6a..b258a66 100644 --- a/core/lib/Drupal/Core/Database/Driver/mysql/Upsert.php +++ b/core/lib/Drupal/Core/Database/Driver/mysql/Upsert.php @@ -17,13 +17,6 @@ class Upsert extends QueryUpsert { /** * {@inheritdoc} */ - public function execute() { - return parent::executeHelper(); - } - - /** - * {@inheritdoc} - */ public function __toString() { // Create a sanitized comment string to prepend to the query. $comments = $this->connection->makeComment($this->comments); diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Upsert.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Upsert.php index 3d651d5..9287884 100644 --- a/core/lib/Drupal/Core/Database/Driver/sqlite/Upsert.php +++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Upsert.php @@ -17,13 +17,6 @@ class Upsert extends QueryUpsert { /** * {@inheritdoc} */ - public function execute() { - return parent::executeHelper(); - } - - /** - * {@inheritdoc} - */ public function __toString() { // Create a sanitized comment string to prepend to the query. $comments = $this->connection->makeComment($this->comments); diff --git a/core/lib/Drupal/Core/Database/Query/Upsert.php b/core/lib/Drupal/Core/Database/Query/Upsert.php index d455961..fbbcbf4 100644 --- a/core/lib/Drupal/Core/Database/Query/Upsert.php +++ b/core/lib/Drupal/Core/Database/Query/Upsert.php @@ -94,29 +94,6 @@ public function preExecute() { * {@inheritdoc} */ public function execute() { - - } - - /** - * Implements PHP magic __toString method to convert the query to a string. - * - * In the degenerate case, there is no string-able query as this operation - * is potentially two queries. - * - * @return string - * The prepared query statement. - */ - public function __toString() { } - - /** - * Runs the query against the database. - * - * This implementation works for both MySQL and SQLite. - * - * @return \Drupal\Core\Database\StatementInterface|null - * A prepared statement, or NULL if the query is not valid. - */ - protected function executeHelper() { if (!$this->preExecute()) { return NULL; } @@ -137,4 +114,17 @@ protected function executeHelper() { return $last_insert_id; } + /** + * Implements PHP magic __toString method to convert the query to a string. + * + * In the degenerate case, there is no string-able query as this operation + * is potentially two queries. + * + * @return string + * The prepared query statement. + */ + public function __toString() { + throw new \BadMethodCallException('There is no generic cross-database way to implement UPSERT queries, each driver must implement their own logic.'); + } + }