Continue solving sheathing issues in infix subqueries #2387
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After initially looking problems with the #2335 fix (for #2328) that were presented in #2340 the problem seems deeper then it originally seemed. The 1st problem was that materializeQueryMeta added an additional map clause to the query making any solution in
SqlIdiom
viacase a: Query =>
more difficult. For example, inforUpdate
in SqlDslSpec instead of this:The
a
parameter will be this:This is problematic because if we want to use a NamingSchema e.g.
io.getquill.naming.UpperCase
we can introduce a Ast CaseClass:Doing this after
.map(x => (x.s, x.i, x.l, x.o))
makes no sense, this map clause is introduced by materializeQueryMeta.Now materializeQueryMeta originally was introduced to expand aliases in queries for example in:
We need to expand that query to
SELECT p.name, p.age FROM Person p
in ExpandNestedQueries however if we just haveIdent(p)
in the SelectValue with no further information we do not know enough information to perform the expansion. This why materializeQueryMeta was introduced i.e. to addquery[Person].map(p => p).map(p => (p.name, p.age))
to the query so that the correct SelectValue clauses could be introduced.However, now since we have Quat information on identifiers, we know what fields are on
Ident(p)
(i.e.Ident(p, CC(name:V,age:V))
) so we can just expand the fields normally. This has already been implemented in previous iterations in ExpandNestedQueries making the materializeQueryMeta component no longer necessary however it was kept in case the quat-based mechanism does not work. Now since there is a good use-case to remove it, this has been done in #2381.Now what remains is to implement Implement the CaseClass wrapping as has been mentioned before. This has been attempted but so far is not working.
Additionally, even if this is implemented, the wrapping will not account for schemaMetas. This will likely be done in later steps.