SQLQuery and Datatypes

classic Classic list List threaded Threaded
4 messages Options
javastuff.sam@gmail.com javastuff.sam@gmail.com
Reply | Threaded
Open this post in threaded view
|

SQLQuery and Datatypes

Hi

My cached object is Binarylizable. I am using SQLQuery and SQLFieldQuery.

In some cases I need to query on a hardcoded/fixed filter e.g. Name = 'xyz'. Same usecase for Long, Date, TimeStamp datatype as well.

Basically not using setArgs().

I see it works fine for String, Int, Long.
- Can I use formatted string for Date, Timestamp and Boolean datatypes?
- If yes - What format for Date and Timestamp? Is there any disadvantages because not using proper datatype and setArg?

Thanks,
-Sam  




vdpyatkov vdpyatkov
Reply | Threaded
Open this post in threaded view
|

Re: SQLQuery and Datatypes

Hi,

I think it will be possible for java.util.Date, but you you are should format date which was been understanding by H2 db.
But you can use constants as parameters and it will be more flexible.

For dynamic SQL parameters are useful when more then one query generated with on query text, but various parameters.
For static SQL it always been workarounded.
javastuff.sam@gmail.com javastuff.sam@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: SQLQuery and Datatypes

It would be helpful to understand how the date and timestamp are stored with writeDate and writeTimestamp specifically for the format perspective. So that I can create queries on the same line if I choose not to use setArgs.

Thanks,
-Sam

 
Sergi Vladykin Sergi Vladykin
Reply | Threaded
Open this post in threaded view
|

Re: SQLQuery and Datatypes


2017-04-24 21:28 GMT+03:00 [hidden email] <[hidden email]>:
It would be helpful to understand how the date and timestamp are stored with
writeDate and writeTimestamp specifically for the format perspective. So
that I can create queries on the same line if I choose not to use setArgs.

Thanks,
-Sam





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/SQLQuery-and-Datatypes-tp12167p12210.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.