InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples
FAQs

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

InstantDB: RE: InstantDB and Date columns


Johan

There's a couple of gotchas in IDB date processing to look out for. The main
one is that date columns are associated with the date format that was in
effect when they got created. i.e. You can't change the way a date gets
displayed once the table has been created.

I also notice that you set your date format to "yyyy-mm-dd hh:nn:ss.l". IDB
won't recognise this. You have to use "yyyy-mm-dd hh:nn:ss.lll" if you want
milliseconds to get included.

I've attached a very simple program that shows how to store timestamps in
IDB. It shows what happens when you create a date column with a full
timestamp format and then insert various values. It inserts one value in the
column's expected format, one in an alternative format (and illustrates how
dates can be ambiguous) and a couple of object based PreparedStatement
values. This example can't accept Time objects because it's expecting a date
to always be included.

Hope some of this helps. If you need more info, then please post to
instantdb@enhydra.org. That way, others will get answers to some of these
questions as well.

Regards

Peter Hearty
Lutris Technologies UK


-----Original Message-----
From: Johan Compagner [mailto:jcompagner@j-com.nl]
Sent: 07 November 2000 16:56
To: bugs@enhydra.org
Subject: Re: InstantDb and Date columns


I tested it some more but what ever i do
setting a line in the PRP file:
dateFormat=yyyy-mm-dd hh:nn:ss.l
or
SET DATE FORMAT "yyyy-mm-dd hh:nn:ss.l"

AWT-EventQueue-0 insert into schema values ( 1 , 11 , '2000-11-07
16:43:00.0' , '')

does not insert the time portion.

And i read your doc:
<<
Inserting a literal timestamp into a date column will result in the full
timestamp being inserted, regardless of the date format.
Time zone differences can also result in unexpected values in a date column.
>>
That's exactly what i want!!
But it doesn't work so it must be a bug?

My locale is "nl","nl" (the netherlands)

The only whay for me to insert time into InstantDb is to use:
AWT-EventQueue-0 insert into schema values(2,2,'21-01-2000 19:00' ,'')

But i don't want to generate my own time stamp, i want to set objects (Date
or Timestamp)
and those are generating the wrong value:
insert into schema values ( 1 , 11 , 2000-11-07 16:43:00.0 , __-__ )

greetings
Johan Compagner
J-COM

P.S. when will the source be released? Then i can look and fix this myself!!



----- Original Message -----
From: "Johan Compagner" <jcompagner@j-com.nl>
To: <bugs@enhydra.org>
Sent: Tuesday, November 07, 2000 5:11 PM
Subject: InstantDb and Date columns


> Hi,
>
> something is going wrong with date columns.
>
> I is set a Date (or TimeStamp) througth the preparedstatement:
> ps.setTimestamp(x, myTimeStamp)
> and i execute that ps.
>
> then i see this happening:
> AWT-EventQueue-0 insert into schema values ( 1 , 11 , 2000-11-07
16:43:00.0 , __-__ )
>
> But because of the different dateformat that InstantDb has.
> the time (hh:nn) is suddenly not inserted!!
>
> I tried things out setting the dateFormat property myself.
> and yes the time is only inserted when the dateformat property is exactly
the same.
> But can i be sure that when i provide the statement only a Date object
what kind of format
> PrepareStatement is generating for that date object???
>
> If i set a DATETIME column with a TimeStamp of Date object (so i don't
generate the insert statement myself)
> then regarless of what format is set i want the complete date (inc hh:nn)
inserted in the database
> (because it is a date TIME column)
>
> But if this can't be done easy then i propose another thing:
> When generating the date string from a date or timestamp object. The jdbc
driver/ statement class checks
> the dateformat string of the database and formats the Date/Time Object
accoordenly.
> So that it always follows the right format string.
>
> For now i must set the dateformat string to yyyy-dd-mm hh:nn.ss.lll
> But what happens if my program runs under a different locale??
> Will the same dateformat string be generated from the timestamp?
>
> please fix this.
>
> thx
> Johan Compagner
> J-COM
>
>
>
>
>
>
>



begin 666 simple.java
M:6UP;W)T(&IA=F$N<W%L+BH[#0II;7!O<G0@;W)G+F5N:'ED<F$N:6YS=&%N
M=&1B+FID8F,N*CL-"@T*8VQA<W,@<VEM<&QE('L-"@T*"7-T871I8R!3=')I
M;F=;72!S<6QS(#T@>PT*"0DB1%)/4"!404),12!M>71A8FQE(BP-"@D)(E-%
M5"!$051%($9/4DU!5" G>7EY>2UM;2UD9"!H:#IN;CIS<RYL;&PG(BP-"@D)
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" H,2P@
M-"D[#0H)"0D)"7!S+G-E=$1A=&4@*#(L(&YE=R!J879A+G-Q;"Y$871E*&YO
M=RDI.PT*"0D)"0EP<RYE>&5C=71E("@I.PT*"0D)"0EP<RYS971);G0@*#$L
M(#4I.PT*+R\)"0D)"7!S+G-E=%1I;64@*#(L(&YE=R!4:6UE*&YO=RDI.PT*
M+R\)"0D)"7!S+F5X96-U=&4@*"D[#0H)"0D)?2!E;'-E('L-"@D)"0D):68@
M*'-T;70N97AE8W5T92AS<6PI*2![#0H)"0D)"0EI9&)297-U;'1S4V5T(')S
M(#T@*&ED8E)E<W5L='-3970I<W1M="YG971297-U;'13970H*3L-"@D)"0D)
M"7)S+F1U;7 H*3L-"@D)"0D)"7)S+F-L;W-E*"D[#0H)"0D)"7T@+R\@:68-
M"@D)"0E]("\O(&EF+65L<V4-"@D)"7T@+R\@9F]R#0H)"0ES=&UT+F-L;W-E
M*"D[#0H-"@D)"6-O;BYC;&]S92@I.PT*"0E](&-A=&-H("A%>&-E<'1I;VX@
M97@I('L-"@D)"65X+G!R:6YT4W1A8VM4<F%C92 H*3L-"@D)?0T*"7T-"@T*
#?0T*
`
end

-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.