> -----Original Message-----
> From: John McNally [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 04, 2001 1:59 PM
> To: [EMAIL PROTECTED]
> Subject: Re: cvs commit:
> jakarta-turbine-2/src/java/org/apache/turbine/util/db
> SqlExpression.java
>
>
> [EMAIL PROTECTED] wrote:
> >
> <snip>
> >
> >
> > 1.2 +4 -2
> jakarta-turbine-2/src/java/org/apache/turbine/util/db/SqlExpre
> ssion.java
> >
> > Index: SqlExpression.java
> >
> ===================================================================
> > RCS file:
> /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/d
> b/SqlExpression.java,v
> > retrieving revision 1.1
> > retrieving revision 1.2
> > diff -u -r1.1 -r1.2
> > --- SqlExpression.java 2001/08/16 05:09:49 1.1
> > +++ SqlExpression.java 2001/09/01 08:37:14 1.2
> > @@ -59,6 +59,7 @@
> > import java.util.Date;
> > import java.util.Iterator;
> > import java.util.List;
> > +import java.sql.Timestamp;
> >
> > import org.apache.turbine.om.DateKey;
> > import org.apache.turbine.om.ObjectKey;
> > @@ -79,7 +80,7 @@
> > *
> > * @author <a
> href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
> > * @author <a
> href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
> > - * @version $Id: SqlExpression.java,v 1.1 2001/08/16
> 05:09:49 jvanzyl Exp $
> > + * @version $Id: SqlExpression.java,v 1.2 2001/09/01
> 08:37:14 fedor Exp $
> > */
> > public class SqlExpression
> > {
> > @@ -290,7 +291,8 @@
> > else if( criteria instanceof java.util.Date ||
> > criteria instanceof DateKey)
> > {
> > - criteria = db.getDateString(criteria.toString());
> > + Date dt = criteria instanceof Date?(Date)
> criteria:((DateKey)criteria).getDate();
> > + criteria = "{ts '" + new
> Timestamp(dt.getTime()).toString() + "'}";
> > }
> > else if( criteria instanceof Boolean )
> > {
> >
> >
>
> This will cause a loss of precision, if criteria is a Timestamp the
> getTime() method only returns integral seconds.
_milliseconds_ - should be enough. And if you are eventually converting to
Date you will lose nanos anyway.
>
> I have a question/reservation about the jdbc escape. If the
> column is a
> date column of some type other than timestamp, is the driver
> expected to
> parse the jdbc escape properly? It seems conceivable that it may just
> throw an exception.
not sure about this, but so far this is the best solution I know about...
fedor.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]