salk31 / RedQueryBuilder

SQL Query Builder UI JavaScript component
http://redquerybuilder.appspot.com/
Eclipse Public License 1.0
95 stars 22 forks source link

RedQueryBuilderFactory.create error with NOT IN statements #3

Closed matt-schwartz closed 10 years ago

matt-schwartz commented 10 years ago

If I use NOT IN, like

"name" : "REF",
"editor" : "SELECT",
"operators" : [ {
    "name" : "IN",
    "label" : "is",
    "cardinality" : "MULTI"
}, {
    "name" : "NOT IN",
    "label" : "is not",
    "cardinality" : "MULTI"
}]

It generates good SQL, but that SQL fails when passed into RedQueryBuilderFactory.create. The console says

java.sql.SQLException: In SELECT "x0"."title", "x0"."description", "x0"."status", "x0"."priority", "x0"."bug", "x0"."created_time", "x0"."modifieid_time" FROM "ticket" "x0" WHERE ("x0"."status" NOT IN (?, ?)) at 171 wanted )

171 is the start of "NOT".

salk31 commented 10 years ago

Would you have any interest in RQB support "NOT (a=b AND b=c)"?

i.e. try and support every operator offering "NOT"?

maybe "not in" is a special case. Not sure I'd want to inflict a generic "NOT" on end users.

matt-schwartz commented 10 years ago

I think "NOT IN" is a common case and easier to handle (just like "<>"). I don't think every other use of "NOT" would be as useful or as common. For my app I can live without NOT entirely, but "NOT IN" would be nice to have.

salk31 commented 10 years ago

Leaning towards a boolean flag on the operator. Something like "support NOT". So then would work with NOT BETWEEN, NOT AND etc (one day).

salk31 commented 10 years ago

Took me a while but I've ended up where you started. Bit fragile as depends on prefix being exactly "NOT " (note single whitespace).

Please could you try http://0-6-0.redquerybuilder.appspot.com/

If OK I'll make more robust.