db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Usselmann, Vitali" <Usselm...@elkware.com>
Subject AW: comparing timestamp
Date Tue, 30 Sep 2003 09:52:43 GMT


Hi,

the TIMESTAMP type in mysql gets auto updated everytime
you touch that row. See: http://www.mysql.com/doc/en/DATETIME.html

If you do not want that behaviour, you need to change one line
the  generation template in
 <torque>\templates\sql\base\mysql\db.props

I changed
  TIMESTAMP = TIMESTAMP
to
  TIMESTAMP = DATETIME

Afterwards you need to rebuild you objects.
I hope this helps.

regards, Vitali


-----Urspr√ľngliche Nachricht-----
Von: Amit Rana [mailto:rana@solis.jp]
Gesendet: Dienstag, 30. September 2003 07:53
An: torque-user@db.apache.org
Betreff: comparing timestamp


Hi,

	I am having problem in writing a query based on dates. I have
following table
<table name="TBL_ORDERS">
	<column name="orderCreatedDate" type="TIMESTAMP"
required="true"/>
	<!--other columns removed-->
</table>
In mysql-
CREATE TABLE TBL_ORDERS
(
	orderCreatedDate TIMESTAMP NOT NULL
);

	I want to select records which lie between specified dates or
greater than a particular date. I tried following but none of these
work? 
1. criteria.addDate(TblOrdersPeer.ORDERCREATEDDATE, year,month,day,
Criteria.GREATER_THAN);
this results in: FROM TBL_ORDERS WHERE
TBL_ORDERS.ORDERCREATEDDATE>'20031029000000'

2. criteria.add(TblOrdersPeer.ORDERCREATEDDATE,(Object) "2003/09/30" ,
Criteria.GREATER_THAN);
this results in: FROM TBL_ORDERS WHERE
TBL_ORDERS.ORDERCREATEDDATE>'9/30/2003'

Date in the DB is: 9/30/2003 2:27:27 PM, I used following to set the
date
order.setOrdercreateddate(new Date(System.currentTimeMillis()));

Am I missing something obvious? Please advice how can I get this to
work? I want to search orders based on dates.

Regards,
Amit.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message