hi thomas,

these are the ojb definitions for date, time and timestamp:

           // Date
       |   "date" tokDate:StringLiteral
           // Format yyyy-mm-dd
           { value = java.sql.Date.valueOf(tokDate.getText()); }

           // Time
       |   "time" tokTime:StringLiteral
           // Format hh:mm:ss
           { value = java.sql.Time.valueOf(tokTime.getText()); }

           // Timestamp
       |   "timestamp" tokTs:StringLiteral
           // Format yyyy-mm-dd hh:mm:ss.fffffffff
           { value = java.sql.Timestamp.valueOf(tokTs.getText()); }

jakob

Thomas Phan wrote:

hi jakob,

thx, it's nice to follow odmg. i wondered because i saw
http://www.castor.org/oql.html, they use ', and we use "

and they allow $[(type)]longLiteral for the data holder

Thomas Phan
Project Leader
Entersys Limited
Unit 2003, Asia Trade Center,
79 Lei Muk Road,
Kwai Chung, Hong Kong
T: +852 2332 0318
M: +852 9312 8127
F: +852 2368 2966
ICQ: 1032474

www.entersys.com
An Enterprise System Solution Provider using the J2EE & .NET technology
----- Original Message -----
From: "Jakob Braeuchi" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, March 18, 2003 2:09 AM
Subject: Re: OQL datetime string




hi thomas,

ojb's oql is based on oql.g from odmg and afaik the date comes from
there ...

jakob

Thomas Phan wrote:



Hi,

I looked at the source code in OQLParser.java, and LITERAL_date="date"=58
(in OQLLexerTokenTypes.txt)

 case StringLiteral:
 {
  tokStr = LT(1);
  match(StringLiteral);
  value = tokStr.getText();
  break;
 }
 case LITERAL_date:
 {
  match(LITERAL_date);
  tokDate = LT(1);
  match(StringLiteral);
  value = java.sql.Date.valueOf(tokDate.getText());
  break;
 }

I think the syntax is "select user from " + Users.class.getName() + "


where


modifiedOn<= date \"2003-03-17\"", but is this the OQL standard?

Thomas

----- Original Message -----
From: "Thomas Phan" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Monday, March 17, 2003 7:03 PM
Subject: Re: OQL datetime string






Thanks Charles,

I want to avoid using bind(). Here's my situation:

- my program has a client, a server
- the server contains OJB, and Java
- the client is .NET
- I want to pass OQL statements as a string from the client to the


server.


For the OQL parameters, java.lang.Object[] cannot be my choice, since


the


web service protocol doesn't marshal that. But if I marshal the


parameters


as String[], i need some extra info to convert those strings back to


their


related data type
- But if I bind a java.sql.Date object as a java.lang.String object, the
Oracle driver gives me an error (while some other JDBC drivers are fine)
- allowing the OQL statement to be generated on the client makes the




search




more flexible

----- Original Message -----
From: "Charles Anthony" <[EMAIL PROTECTED]>
To: "'OJB Users List'" <[EMAIL PROTECTED]>
Sent: Monday, March 17, 2003 6:45 PM
Subject: RE: OQL datetime string






Instead of doing that, bind a variable in the query...
I don't use OQL, but off the top off my head

OQLQuery q = odmg.newOQLQuery().create("select user from " +
Users.class.getName() + "
   where modifiedOn<={0}")
q.bind(theDateTimeValueAsADate);






-----Original Message-----
From: Thomas Phan [mailto:[EMAIL PROTECTED]
Sent: 17 March 2003 10:41
To: OJB Users List
Subject: OQL datetime string


Hi,


Is there an escaped string format for datetime in OQL that
allows all JDBC
drivers to:

odmg.newOQLQuery().create("select user from " +
Users.class.getName() + "
where modifiedOn<='2003-03-17'"); <- I'm not sure about the
"modifiedOn<='2003-03-17'" part

In JDBC, we can "select * from Users where modifiedOn<={d
'2003-03-17'}"


FYI,


CREATE TABLE Users(
 userId          VARCHAR2(50)     NOT NULL,
...
 createdBy       VARCHAR2(50),
 createdOn       DATE,
 modifiedBy      VARCHAR2(50),
 modifiedOn      DATE,
 CONSTRAINT PK_Users PRIMARY KEY (userId)
);

Thanks

Thomas


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





This email and any attachments are strictly confidential and are




intended




solely for the addressee. If you are not the intended recipient you


must


not disclose, forward, copy or take any action in reliance on this




message




or its attachments. If you have received this email in error please




notify




the sender as soon as possible and delete it from your computer


systems.


Any views or opinions presented are solely those of the author and do




not




necessarily reflect those of HPD Software Limited or its affiliates.

At present the integrity of email across the internet cannot be




guaranteed




and messages sent via this medium are potentially at risk. All




liability




is excluded to the extent permitted by law for any claims arising as a




re-




sult of the use of this medium to transmit information by or to
HPD Software Limited or its affiliates.



---------------------------------------------------------------------
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]




---------------------------------------------------------------------
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]




---------------------------------------------------------------------
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