Company filter = gson.fromJson(filterAsJSON, Company.class);CompanyRecord filterRecord = tx.newRecord(COMPANY, filter);
companys = tx.selectFrom(COMPANY).where(condition(filterRecord)) .fetch();
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/9d4a1960-6813-4f61-9eac-28620b70955e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
but how would such an API be configured? How would it detect what kind of predicate you want to have expressed given only an input record?
the obvious solution is to write your own QBE API
public static Condition likeCondition(Record record) { Field<?>[] fields = record.fields(); for(int i = 0; i < fields.length; ++i) { fields[i].like(record.get(i).toString()); } return null;}
Hi Lukas,but how would such an API be configured? How would it detect what kind of predicate you want to have expressed given only an input record?The current idea was to keep it as simple as possible and to provide a company object for each condition type ("like", ">", and so on). The subject is to implement a filter mechanism of a table, in each column you have one filter input as String. I'm building everything from scratch, thus I'm free how to implement it.
the obvious solution is to write your own QBE APII have started to prototype such a function by my own, but I struggle to build the condition based on the sniped below, connected by "and".
public static Condition likeCondition(Record record) {Field<?>[] fields = record.fields();for(int i = 0; i < fields.length; ++i) {fields[i].like(record.get(i).toString());}return null;}
Do you have any suggestions? ( I can't create a Condition object, thats the problem thus far)
Condition condition = DSL.noCondition(); // Or DSL.trueCondition()for (...)condition = condition.and(...);
public static Condition likeCondition(Record record) {
Condition condition = DSL.noCondition();
Field<?>[] fields = record.fields();
for(int x = 0; x < fields.length; x++) { if(record.get(x) != null) { condition = condition.and(fields[x].like(record.get(x).toString()+"%")); } } return condition;}
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/e480c662-123f-4d5d-b346-3fd1379f6487%40googlegroups.com.
condition = condition.and(fields[x].greaterOrEqual(record.get(x));
condition = condition.and(fields[x].greaterOrEqual(DSL.zero()));
Integer b = new Integer(5);
condition = condition.and(fields[x].greaterOrEqual(b));
condition = condition.and(fields[x].greaterOrEqual((Field) record.get(x));
condition = condition.and(fields[x].greaterOrEqual((Field) DSL.zero()));
Integer b = new Integer(5);
condition = condition.and(fields[x].greaterOrEqual((Field) DSL.val(b)));
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/6c0bbc52-8033-4c63-be85-fa5be6b02f53%40googlegroups.com.
The current idea was to keep it as simple as possible and to provide a company object for each condition type ("like", ">", and so on). The subject is to implement a filter mechanism of a table, in each column you have one filter input as String. I'm building everything from scratch, thus I'm free how to implement it.I see, interesting. I'll give this some thoughts. Surely, the default of using "=" can be overridden in a meaningful way that is easy to discover and simple to use. I'll revert back to this discussion once I have a more clear idea.