I'm working a version of the Views Unionize module for D7, with a different UI. I've hit a show stopper issue here #1786828: Views join condition placeholders incrementing incorrectly that needs a small change in the views_join::build_join method. The net effect is the same :views_join_condition(s) placeholders are being re-used by each of the UNIONed Views' queries.
The issue I'm trying to solve is the build_join method does not keep a running log of the SelectQuery::$nextplaceholder property across multiple UNIONed queries as the placeholders are assigned when the build_join method is called as opposed to writing them when the entire SelectQuery object is passed off to DBTNG (as with conditions).
Comment | File | Size | Author |
---|---|---|---|
#13 | maintain_views_join-1787072-13.patch | 1.25 KB | bigjim |
#5 | views_join_condition_increment_5.patch | 1.11 KB | bigjim |
#4 | views_join_condition_increment_2.patch | 1.33 KB | bigjim |
views_join_condition_increment.patch | 1.33 KB | bigjim | |
Comments
Comment #1
dawehnerWhat about using views_plugin_query_default::placeholder() instead?
Comment #2
bigjim CreditAttribution: bigjim commentedHa, learn something new everyday. So making that change throws an error from DBTNG:
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
Same error called statically or as $view_query->placeholder(). Any ideas why there would be a mismatch? The SQL looks okay. I'll dig in a little more.
Comment #3
dawehnerThis probably causes the problem ... in general i would really really really vote for a dbtng solution.
This change doesn't look right
Comment #4
bigjim CreditAttribution: bigjim commentedYou're right on the typo, updated patched attached here (based on originally proposed method).
though to be clear:
this works fine
and
Both throw the "SQLSTATE[HY093]" error
I'm 100% with you on the DBTNG fix, though the way DBTNG handles join conditions makes that quite difficult. The most significant limitation being that you have to assign the join condition placeholder key before you hand the SelectQuery object off to DBTNG.
Comment #5
bigjim CreditAttribution: bigjim commentedOkay patch using the placeholder() function attached here.
Comment #6
bigjim CreditAttribution: bigjim commentedWe've been using this in production for a couple months no with no issues. While I totally agree with the desire to get this fixed in DBTNG I don't see tat happening anytime soon and it's doubtful any such fix would get back ported to D7 in a reasonably timely manner.
Moving to RTBC, changed
Comment #7
dawehnerSure i totally see why you mark this issue as RTBC, and i think this is RBC, but you should not do this
with your own patches.
Comment #8
star-szrComment #9
Darren Oh5: views_join_condition_increment_5.patch queued for re-testing.
Comment #10
Darren OhThis was reviewed a long time ago and still passes testing.
Comment #11
dawehnerCommitted and pushed to 7.x
This needs something similar in Drupal 8.
Comment #12
bigjim CreditAttribution: bigjim commentedI can work on this one
Comment #13
bigjim CreditAttribution: bigjim commentedDrupal 8 patch here for test bot.
Comment #14
bigjim CreditAttribution: bigjim commentedforgot to mark needs review
Comment #16
dawehnerThanks for posting the patch!
I guess we need some dedicated test coverage here as well
Comment #17
mgiffordComment #18
dawehner... its a bug,
Comment #25
Darren OhComment #30
LendudeI have no idea if this is still relevant, it feels outdated and more like a feature request now than a bug if it is. I understand this got changed in D7, but ¯\_(ツ)_/¯
If this is needed for D8 please feel free to open this back up and provide arguments why this needs to be changed in core and can't handled in contrib.
For now I'm moving this back to D7 and marking it fixed.
Comment #31
LendudeForgot to tag
Comment #32
Lendude