You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by David Meaker <Da...@angelshade.com> on 2001/06/08 14:28:12 UTC

SQL Database system date - platform independence

Hi,

I have an application that currently operates on both a MySQL platform and a
MSSQL platform. I am using Peers for all data access. There is a requirement
to ensure the application uses the Database server's time.  So I use 

...
criteria.add( Race.getStarts(), (Object) "NOW()", Criteria.GREATER_THAN )
...

the call to "NOW()" or "SYSDATE()" is MySQL and Oracle specific.  
MSSQL and Sybase use "GETDATE()" or "CURRENT_TIMESTAMP".  

1) Would the correct way of implementing a platform independent reference to
a String with the appropriate function name be the alteration the abstract
class org.apache.turbine.util.db.adapter.DB to include a 

	public String getSystemDateFunctionName()

and then implement the platform specific strings in the DBMM.java,
DBSybase.java etc.

2) What would be the correct way to implement the call so that the
SystemDateFunctionName returns the correct string for database that the Race
table is in.

criteria.add( Race.starts, (Object) Race?????.getSystemDateFunctionName(),
criteria.GREATER_THAN )

or have I missed something obvious?

kind regards

	Dave Meaker

----------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.   If you received
this in error, please contact the sender and delete the material from any
computer.



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org