Re: Wrong SQL when joining in an OR-part of the qualifier

2022-02-15 Thread Samuel Pelletier via Webobjects-dev
OC, I do not see your point about the qualifierWithQualifierFormat. Unless your users are writing the format string directly, you have code to build it. Building a qualifier format string or a qualifier object is the same thing, it is just easier and less error prone to build the object using E

Re: Wrong SQL when joining in an OR-part of the qualifier

2022-02-14 Thread OCsite via Webobjects-dev
Thanks to all for the answers! Is there a way to use the ERExistsQualifier through qualifierWithQualifierFormat? At the particular place it would be somewhat difficult to create the qualifier tree programmatically, there are considerably more complex qualifiers ANDed and ORred to the thing, whi

Re: Wrong SQL when joining in an OR-part of the qualifier

2022-02-14 Thread Samuel Pelletier via Webobjects-dev
Hi, As Aaron wrote, ERExisitsQualifier will generate an SQL for your needs. You may also change the JOIN type to change it's behaviour in SQL. EOF apply table joins before qualifier, I suspect other ORM does the same too. For that kind of quarry, you will probably have better performance doing

Re: Wrong SQL when joining in an OR-part of the qualifier

2022-02-14 Thread Theodore Petrosky via Webobjects-dev
I have only worked with Oracle and Postgresql. Any time I have a problem like this, I create a view on the database that does half the query. Or in your case, the ‘view’ could do all the heavy lifting. It’s an idea. Ted > On Feb 14, 2022, at 1:13 AM, ocs--- via Webobjects-dev > wrote: > >

Re: Wrong SQL when joining in an OR-part of the qualifier

2022-02-14 Thread Aaron Rosenzweig via Webobjects-dev
Hi OC, That’s called the object to relational impedance mismatch. The qualifier works in memory but fails when you try to invoke with SQL. To get around it, you can use an ERXExistsQualifier for your to-one relationship. Typically you use this with to-many relationships but it actually can wo

Wrong SQL when joining in an OR-part of the qualifier

2022-02-13 Thread ocs--- via Webobjects-dev
Hi there, lately, I am encountering wrong fetches (with FrontBase, if important). I log out my qualifier and SQL, and the gist of the problem is a join in the OR-part of the qualifier. I want to fetch rows where there's an empty attribute, OR when there's a specific join: 06:52:06.510 DEBUG ->