Re: EOF & pgSQL join syntax
Re: EOF & pgSQL join syntax
- Subject: Re: EOF & pgSQL join syntax
- From: Anjo Krank <email@hidden>
- Date: Fri, 30 Apr 2004 07:22:43 +0200
- Xx-reply-to: email@hidden
Folks,
I recently added "PlugIn" section on Project Wonder (current HEAD CVS),
where there is currently a PG plugin you can check out and contribute
to again. The plugin supports nifty stuff like the "*~" regex operator
and fixes a bug when generating NSData selects.
That being said, the problem is that EOF constructs the statement like:
select ... from a, b where a.x <some operator> b.y and ...
whereas Postgres would like
select ... from a <left|right> <inner|outer> join b on (a.x=b.y) where
...
and also you have no knowledge of your destination entity when
assembleJoinClause() is called.
So I guess you need to also re-implement
prepareSelectExpressionWithAttributes() and probably
assembleSelectStatementWithAttributes() of EOSQLExpression to change
the order in your subclass.
It would be great if you could add your code to Wonder once you are
finished:)
Cheers, Anjo
Am 30.04.2004 um 06:13 schrieb Chuck Hill:
I've never done this. As near as I can figure it...
EOSQLExpression has this method:
public String assembleJoinClause(String leftName,
String rightName,
int semantic)
This method is invoked from addJoinClause to return a JOIN clause. The
clause is of the form:
leftName operator rightName
where operator is "=" for an inner join, "*=" for a left-outer join,
and
"=*" for a right-outer join.
Therein lies the "root of evil".
For our purposes we are interested in the subclass
com.webobjects.jdbcadaptor.JDBCExpression. You will need to subclass
that,
and re-implement assembleJoinClause to do what you want. Who knows,
you
might need to attend to some other methods as well. If there is a
PostgreSQL plugin, then it probably already has this class.
Then our task becomes, "How do I get EOF to use this expression
class?".
Here is where Art's point comes into play.
com.webobjects.jdbcadaptor.JDBCPlugIn has the method
public Class defaultExpressionClass()
which you can use to the return the clase of your customized
JDBCExpression
sub-class.
I *think* that should do it, but there are a few other methods that you
might want to look over if things don't work. Not trivial, but totally
doable.
Chuck
At 05:38 PM 29/04/2004 -1000, Art Isbell wrote:
On Apr 29, 2004, at 2:46 PM, Arturo Pirez wrote:
In any case, I found a Radar for MySQL with the exact same issue in
the 5.2 release notes. There was no fix and no workaround. With
this
added information, do you still think I can fix it in the plugin?
I'd give it a try. This Radar states that the JDBC adaptor supports
Oracle and Sybase. I'm guessing that it does so by testing for the
database type and providing the correct operator. But the JDBC
adaptor
may not test for MySQL and PostgreSQL, so the default EOF outer join
operator, "*=", is used which is invalid for MySQL and PostgreSQL.
JDBC WO plugins should be able to deal with such things, I would
think.
But what do I know?
Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
--
Chuck Hill email@hidden
Global Village Consulting Inc.
http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
Cheers, Anjo
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.