On issues like #1935300: Don't hardwire Database in Views filters, add regexp to DBTNG it became clear that you want to construct the dbtng query object
a bit earlier.

Files: 
CommentFileSizeAuthor
#14 1937414-14.patch8.16 KBjibran
FAILED: [[SimpleTest]]: [MySQL] 57,856 pass(es), 179 fail(s), and 55 exception(s).
[ View ]
#14 interdiff.txt1.9 KBjibran
#11 interdiff.txt2.99 KBjibran
#7 views-make-select-objection-earlier-available-1937414-5.patch4.66 KBpwieck
PASSED: [[SimpleTest]]: [MySQL] 57,891 pass(es).
[ View ]
#8 views-make-select-objection-earlier-available-1937414-5.patch4.66 KBpwieck
PASSED: [[SimpleTest]]: [MySQL] 56,366 pass(es).
[ View ]
#8 drupal-1937414-1-5-interdiff.txt5.31 KBpwieck
#6 drupal-1937414-5.patch4.66 KBpwieck
PASSED: [[SimpleTest]]: [MySQL] 57,902 pass(es).
[ View ]
#6 drupal-1937414-1-5-interdiff.txt5.31 KBpwieck
#1 drupal-1937414-1.patch4.65 KBdawehner
PASSED: [[SimpleTest]]: [MySQL] 55,623 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new4.65 KB
PASSED: [[SimpleTest]]: [MySQL] 55,623 pass(es).
[ View ]

Let's give it a try.

#1: drupal-1937414-1.patch queued for re-testing.

Status:Needs review» Reviewed & tested by the community

This is all internal reshuffling, and it makes sense.

Status:Reviewed & tested by the community» Needs work
Issue tags:+Needs reroll

Needs a reroll

curl https://drupal.org/files/drupal-1937414-1_0.patch | git a
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4766  100  4766    0     0   4369      0  0:00:01  0:00:01 --:--:--  5385
error: patch failed: core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php:1239
error: core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.php: patch does not apply

Working on reroll now.

StatusFileSize
new5.31 KB
new4.66 KB
PASSED: [[SimpleTest]]: [MySQL] 57,902 pass(es).
[ View ]

Re-rolled. No conflicts with head.

Status:Needs review» Needs work
StatusFileSize
new4.66 KB
PASSED: [[SimpleTest]]: [MySQL] 57,891 pass(es).
[ View ]

-DISREGARD- Forgot to change status.

Status:Needs work» Needs review
StatusFileSize
new5.31 KB
new4.66 KB
PASSED: [[SimpleTest]]: [MySQL] 56,366 pass(es).
[ View ]

Forgot to change status.

Status:Needs work» Needs review
Issue tags:-Needs reroll

Re-roll #8 passed. Needs review. Disregard #6 and #7. I never forgot status before and then made a mess of it.

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.phpundefined
@@ -1338,6 +1319,35 @@ function alter(ViewExecutable $view) {
+   * Implements \Drupal\views\Plugin\views\query\QueryPluginBase::preQuery().

This line should be {@inheritdoc}

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.phpundefined
@@ -1338,6 +1319,35 @@ function alter(ViewExecutable $view) {
+    $query = Database::getConnection($target, $key)

It should be even possible to inject the database connection in the constructor?

StatusFileSize
new2.99 KB
new6.91 KB
FAILED: [[SimpleTest]]: [MySQL] 58,149 pass(es), 1 fail(s), and 1 exception(s).
[ View ]

Fixed #10.

So what about the database connection?

Status:Needs review» Needs work

The last submitted patch, 1937414-11.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.9 KB
new8.16 KB
FAILED: [[SimpleTest]]: [MySQL] 57,856 pass(es), 179 fail(s), and 55 exception(s).
[ View ]

Implemented Serializable as per @dawehner suggestion.

So what about the database connection?

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/query/Sql.phpundefined
@@ -1334,7 +1348,36 @@ public function getWhereArgs() {
+    $query = Database::getConnection($target, $key)

we can't inject because we can't specify database connection.

Status:Needs review» Needs work

The general idea is to not store the database connection in the serialized object, but remove it in serialize() and add it back in unserialize().