Yes, I'm using the 7.2 pgjdbc2.jar, downloaded fairly recently.  Does an
even newer driver implement {ts ...} escapes?

-- Bill
----- Original Message -----
From: "Martin Poeschl" <[EMAIL PROTECTED]>
To: "Turbine Torque Developers List" <[EMAIL PROTECTED]>
Sent: Friday, April 12, 2002 12:16 PM
Subject: Re: Fw: [PATCH] Postgresql date constraints


> Bill Schneider wrote:
> > This is a patch I submitted a while ago to fix date constraints in
> > PostgreSQL and I'm resubmitting it, now with thread-safe use of
> > DateFormatters.  This is necessary because PostgreSQL's driver doesn't
> > support JDBC {ts ...} escapes.
>
> did you try the lates tversion of the postgres driver (7.2) ??
>
> martin
>
> >
> > -- Bill
> >
> > Index: src/java/org/apache/torque/adapter/DBPostgres.java
> > ===================================================================
> > RCS file:
> >
/home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/adapter/DB
> > Postgres.java,v
> > retrieving revision 1.6
> > diff -u -r1.6 DBPostgres.java
> > --- src/java/org/apache/torque/adapter/DBPostgres.java 15 Mar 2002
> > 21:47:45 -0000 1.6
> > +++ src/java/org/apache/torque/adapter/DBPostgres.java 9 Apr 2002
> > 19:41:38 -0000
> > @@ -56,6 +56,8 @@
> >
> >  import java.sql.Connection;
> >  import java.sql.SQLException;
> > +import java.util.Date;
> > +import java.text.SimpleDateFormat;
> >
> >  /**
> >   * This is used to connect to PostgresQL databases.
> > @@ -68,6 +70,9 @@
> >  public class DBPostgres
> >      extends DB
> >  {
> > +    private static final String DATE_FORMAT_STRING =
> > +      "yyyy-MM-dd HH:mm:ss";
> > +
> >      /**
> >       * Empty constructor.
> >       */
> > @@ -192,5 +197,21 @@
> >      public int getLimitStyle()
> >      {
> >          return DB.LIMIT_STYLE_POSTGRES;
> > +    }
> > +
> > +    /**
> > +     * This method is used to format any date string.
> > +     * Database can use different default date formats.
> > +     *
> > +     * @return The proper date formatted String.
> > +     */
> > +    public String getDateString(Date date)
> > +    {
> > +        return "TO_TIMESTAMP('" + formatDate(date) +
> > +            "', 'yyyy-mm-dd hh24:mi:ss' )";
> > +    }
> > +
> > +    private String formatDate(Date date) {
> > +        return new SimpleDateFormat(DATE_FORMAT_STRING).format(date);
> >      }
> >  }
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
> >
>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to