date-time format wrong!!

Joseph Morgan joseph at checkos.com
Tue Dec 11 17:19:53 CST 2007



On Dec 11, 2007, at 3:00 PM, Thorsten Hohage wrote:
> AFAIR I've already written this to the list when the "issue" popped  
> up some months ago, but here we go again...
>
> There are some issues in date handling in REALbasic, so don't blame  
> (only) Vaentina for this issue. When you use this
>
> 	field("").datevalue
>
> then it's REALbasic style you first cast the retrieved value to this  
> <ironic>wonderful</ironic> Variant type and the call a second cast  
> in pure RB to get an instance of the RB data class. Everything what  
> could go wrong here will go wrong here for sure at one of you clients!
>
>
> So it's ways better to use the native Valentina methods
>
> 	Dim pDataSet As DDODataDictionary
> 	Dim pCursor As VCursor
> 	Dim dValue As Date
>
> 	dValue = pCursor.DateField(i).GetDate()
>
> OR
>
> 	dValue = pCursor.TimeField(i).GetTime()
>
> OR
>
> 	dValue = pCursor.DateTimeField(i).GetDateTime()
>
>
> then you can handle the intance of the RB date class in any way you  
> want. I can additional give the advice that if you ever want to  
> store these retrieved values in a Dictionary, then you should use  
> the above step, too and then do a
>
> 	pDataSet.Value("somenamehere") = dValue
>
> this will kept many headaches away from you.
>
>
> Of course it's the same story when writing the data back to  
> Valentina, DON'T USE THE RB STYLE, use the Valentina native
>
>
> 	Dim dummyDate As Date
>
>
> 	myCursor.DateField(i).SetDate(dummyDate)
>
> OR
>
> 	myCursor.DateTimeField(i).SetDateTime(dummyDate)
>
> OR
>
> 	myCursor.TimeField(i).SetTime(dummyDate)
>
>
>
> And for using values from dictionaries it's the same story as  
> retrieving, so always use a
>
> 	dummyDate = pDataList.Value(fieldName)
>
> to first get a real instance of the RB date class and then put it  
> into Valentina.
>
>
>
> Two additional remarks:
>
> * the date class is a real class and not a variable "type" like  
> Integer or Double. A lot of errors happens, because of a developer  
> didn't get the difference
>
> * Don't always trust the RB debugger in the most current versions,  
> there are a lot of glitches and especially with instances of the RB  
> date class they casted to string before displayed!!!!




For me I have just worked around these difficulties. I built a couple  
drop in methods to help cope with the incompatibilities between  
realdatabase api and vrbdatabase (primarily the date issues).

And despite the fact that several people on this list have strongly  
encouraged using valentina api instead of realbasic api I haven't done  
so. (being extremely stubborn and asking for trouble).

When I got started, I was hoping that vrbdatabase would be a drop in  
replacement for the rbdatabase. Unfortunately this is not the case  
(although its close and Ruslan and crew have made several fixes that  
directly affect me). Once the date thing is worked out, the  
vrbdatabase features will stand on their own. If valentina's official  
suggestion is to always switch to valentina api and drop realbasic  
api, then maybe they shouldn't even include the vrbdatabase as a  
feature. I am not suggesting that's what should
happen (then I would really have to rewrite everything).

For me I am not concerned wether is is real's glitches or valentina's  
glitches or a combination of the two. As long as the vrbdatabase is a  
feature I will use it. I have figured out work arounds for all the  
idiosyncrocies that affect me.


More information about the Valentina mailing list