Hi Max,
thanks for reproducing it in the Squeryl test cases.
I was already starting to try it myself when I saw that you had been
faster :-)
You say that H2 handles the milliseconds correctly. However, I have
used H2 (in memory, with the following connect string:
"jdbc:h2:mem:testSquerylRecordDB;DB_CLOSE_DELAY=-1") and nevertheless
had the problem.
Then it's maybe still another problem that I had?
> 2011/1/16 Maxime Lévesque <maxime.leves...@gmail.com>
On 16 Jan., 20:17, Maxime Lévesque <maxime.leves...@gmail.com> wrote:
> Michael, the test case was incomplete, I refined it to verify this :
>
> https://github.com/max-l/Squeryl/issues/issue/95
>
> and it appears that not all DBs handle milliseconds properly,
> It remains to be seen if they require special treatment on the JDBC side, in
> which case
> the adapters could do somsthing about it.
> Some DBs work just fine like Postgres and H2, others trucate at the
> millisecond
> in either the where clause or in the resultset mapping.
> Anyhow it seem to be a Squeryl issue rather than one specific to the
> lift/squeryl/record module.
>
> Max
>
>> >https://github.com/max-l/Squeryl/blob/master/src/test/scala/org/squer...
>
>
> > Hi Michael, could you look at this test case :
>
>
> > It is supposed to test all things related to Timestamp fields, so either
> > this test case is incomplete
> > or the bug is specific to the lift/record/squeryl adapter.
>
> > Thanks
>
> > On Sun, Jan 16, 2011 at 11:06 AM, Michael Gottschalk <
> > migottsch...@googlemail.com> wrote:
>
> >> Hi,
>
> >> I think I found a bug when trying to perform a select based on
> >> timestamp equality. It seems to me that milliseconds are not handled
> >> correctly.
>
> >> If I have the following code (using record type mode; "created" is a
> >> timestamp field):
>
> >> println("Company created: " + company.created.is.getTime)
> >> val company = companies.lookup(1).head
> >> val loadedCompany = from(companies)(c => where (c.created ===
> >> company.created) select(c)).head
>
> >> and I turn on query logging, I get the following result (I'm using H2
> >> database):
>
> >> Company created: Sun Jan 16 16:56:25 CET 2011
> >> Select
> >> Company1.name as Company1_name,
> >> Company1.id as Company1_id,
> >> Company1.postCode as Company1_postCode,
> >> Company1.description as Company1_description,
> >> Company1.country as Company1_country,
> >> Company1.created as Company1_created
> >> From
> >> Company Company1
> >> Where
> >> (Company1.created = ?)
> >> jdbcParams:[Sun Jan 16 16:56:25 CET 2011]
>
> >> I get an empty result set. I would assume that the company that is
> >> previously loaded should be returned.
> >> If I use ">" or ">=", the company is returned. So I think in the
> >> database, there must be some milliseconds value that is not set in the
> >> date field when the object is loaded from the database.
>
> >> Cheers,
> >> Michael
>
>