Hi Gary,

Sorry that I have missed this thread earlier.  I solved the problem by
adding Prepared Statements to BasePeer, although I can't recall if I have
added this to torque (I'll have a look as soon as I have some time free).
Luckily it is fairly easy to do by hand: in your Base*Peer classes you just
replace:

          return BasePeer.doSelect(criteria);

with:

          return BasePeer.doPSSelect(criteria);


This lets BasePeer use PreparedStatements rather than normal statements.
You can then use add(String,Object,String) for your dates.  The added code
will then check the type of the Object added and it will use the addDate()
method for the PreparedStatement, in effect shifting the date conversion
responsibility to the JDBC driver.  Saves you all the work!

~ Leon

----- Original Message -----
From: "Gary Lawrence Murphy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 21, 2001 7:06 AM
Subject: Re: Panic attack: How to select date < now?


>
> This is one reason I'm reluctant to submit a patch: There's far too
> much of the architecture that I don't understand.  It does seem
> reasonable that add(String,Date,String) would require at least an API
> that makes it possible to vary the date string format (some formats
> are _nearly_ universal), but to do this within the plugin architecture
> of the Torque API, well, right now, that's a lane I just don't have
> time to explore.
>
> What I need is a job that doesn't interfer with my work ;)
>
> >>>>> "J" == John McNally <[EMAIL PROTECTED]> writes:
>
>     J> ...  The only way (other than writing adaptor code for each db)
>     J> is to use the PreparedStatement methods when working with
>     J> Dates, you should still be able to add them to the Criteria
>     J> with the generic add.
>
> I understand PreparedStatements from JDBC and I remember seeing
> references to them in the Turbine code, but can you elaborate just a
> bit on "still be able to add them to the criteria with the generic
> add"?
>
> --
> Gary Lawrence Murphy <[EMAIL PROTECTED]> TeleDynamics Communications Inc
> Business Innovations Through Open Source Systems: http://www.teledyn.com
> "Computers are useless.  They can only give you answers."(Pablo Picasso)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to