Re: EOSQLExpression's formatValueForAttribute()
Re: EOSQLExpression's formatValueForAttribute()
- Subject: Re: EOSQLExpression's formatValueForAttribute()
- From: Ray Kiddy <email@hidden>
- Date: Sat, 6 Jan 2007 16:45:08 -0800
On Jan 6, 2007, at 8:17 AM, Ricardo Parada wrote:
Hi All,
There is a method in EOSQLExpression as follows:
public String formatValueForAttribute(Object value, EOAttribute
attribute)
which is supposed to format a value as a string ready for inclusion
in a SQL statement / query.
However the method doesn't seem to really do what it advertises.
It always returns "NULL".
So I went ahead and decompiled the subclasses all the way to the
super class EOSQLExpression:
OraclePlugIn$OracleExpression.java extends
JDBCExpression.java extends EOSQLExpression.java
What I found out is that I'm right. The method doesn't do
anything. Either that or I'm missing something.
I was interested in formatting NSTimestamp and String values mostly.
I see EOSQLExpression has formatStringValue() which I may be able
to use for String values. I still need something for NSTimestamp
values and I may have to write my own.
Any advise on this is appreciated.
Thanks
Decompilation is not guaranteed to give you the complete method. In
this method, one of the things it does is return null, but that is
not all it does. But it does not have any smarts about any particular
adaptor and all it can do is call toString() on something.
But this is why the javadoc for the method says:
This method should be overridden by subclasses to return a string
representation of value suitable for use in an SQL statement,
depending on attribute's externalType.
This is also why the EOSQLExpression class is abstract. There are
implementations for some things, so that subclasses are saved some
heavy lifting, but there are things it should not try to do.
What is the behavior of the subclass of EOSQLExpression in the
adaptor that you are using? Perhaps it is not doing enough in this case.
- ray
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden