Closed seb-bisson closed 5 years ago
It should be usefull to be close to builder pattern:
It is true that you cannot build a complex expression using the QueryBuilder
. You can, however, build a complex expression using the Expression builder, and then add it to the query. Is that not sufficient?
The expression builder permit to add multiple fields/expression. And I'me using it this way.
As I'm writing a cordova plugin, i would like to allow adding sortbyexpression and/or a group by expression and/or a limitExpression as a plugin user could use it.
Does it make sense for you?
Is it not the case that, were we to implement this as you describe, it would necessarily be possible to do this:
QueryBuilder
.select("foo")
.from("bar")
.where(Expression.blahblah())
.select("baz")
.where(Expression.mumble())
We would have to catch this kind of misuse at runtime...
Hey @seb-bisson : Do you have more thoughts on this? I'll close this, if you are good.
We want to build a query given different parameters (with/without where expression, with/without orderby expression, with/without limit expression, ...).
Actually, it's not possible to build a complex query with builder. The only solution we found is to create a query for each situation (more than 10) wich is not optimal and very complex to maintain.
Example: today we handle where expression this way:
Now we want to add or not other conditions.
Do you have any clue to resolve our problems?