Page 1 of 1
TimeStamp data types from xharbour
Posted: Wed Oct 31, 2007 2:32 pm
by reinaldocrespo
Hi.
Lately I've been wanting to use some "new" data types offered by ADT tables. A classical example is a field of data type "timestamp". But I find that this data type is not available from xharbour.
How can I write to a timestamp, double, short, etc... data type field of an ADT table from xharbour?
Any ideas?
Reinaldo.
Posted: Wed Oct 31, 2007 4:16 pm
by Antonio Linares
Reinaldo,
Whats the size in bytes and the contents of a timestamp field in ADT ?
Posted: Wed Oct 31, 2007 6:01 pm
by Marcelo Via Giglio
Antonio,
from ADS help file
8-byte value where the high order 4 bytes are an integer containing a Julian date, and the low order 4 bytes are internally stored as the number of milliseconds since midnight. If using the Advantage CA-Visual Objects RDDs, this is a string type.
and, I have interest in MONEY type too, but I get error when I try to assign some value to this field type
Currency data stored internally as a 64-bit integer, with 4 implied decimal digits from -922,337,203,685,477.5807 to +922,337,203,685,477.5807. The Money data type will not lose precision.
Obviously this is [x]Harbour issue (ADSRDD), but maybe some body in the forum have some solution
saludos
Marcelo
Antonio Linares wrote:Reinaldo,
Whats the size in bytes and the contents of a timestamp field in ADT ?
Posted: Wed Oct 31, 2007 7:55 pm
by Antonio Linares
Marcelo,
Please try this and lets see if the ADS RDD allows it:
test->tstamp := L2Bin( 0 ) + L2Bin( 0 )
MsgInfo( test->tstamp )
where tstamp is a timestamp field
Posted: Thu Nov 01, 2007 4:09 pm
by Marcelo Via Giglio
Antonio,
I tryed, but a get ADSADT/1020 Data type error on the assign command, maybe we need to move the question to the [x]Harbor develop team
gracias
Marcelo
Antonio Linares wrote:Marcelo,
Please try this and lets see if the ADS RDD allows it:
test->tstamp := L2Bin( 0 ) + L2Bin( 0 )
MsgInfo( test->tstamp )
where tstamp is a timestamp field
Posted: Thu Nov 01, 2007 9:29 pm
by Antonio Linares
Marcelo,
>
I tryed, but a get ADSADT/1020 Data type error on the assign command, maybe we need to move the question to the [x]Harbour develop team
>
Yes, it looks as a RDD limitation
Posted: Fri Nov 02, 2007 3:29 am
by nageswaragunupudi
Time stamp fields work well with xHarbour without any extra efforts.
When we read a timestamp field into a memory variable it is a datetime value. And we can straight away assign a datetime value to a timestamp field. For creating an adt table through dbcreate, use 'T' as the field type.
No special effort is needed on our part.
Posted: Fri Nov 02, 2007 3:33 am
by nageswaragunupudi
In the above example, we can simply say :
Code: Select all
test->tstamp := datetime() // or any other datetime variable
// for testing, check
msginfo( ttoc( test->tstamp ) )
Posted: Fri Nov 02, 2007 8:38 am
by Antonio Linares
NageswaraRao,
Thanks!
Posted: Fri Nov 02, 2007 1:14 pm
by Marcelo Via Giglio
NageswaraRao,
thanks for the sample, but the others field type like MONEY how we can work with these. I have special interest in MONEY field for the precision, there are some issues in DOUBLE field type with this issue
regards
Marcelo
Posted: Fri Nov 02, 2007 1:18 pm
by nageswaragunupudi
Mr Marcelo
You simply assign and retrieve numerical values to and from these fields also as usual.
You are mentioning about the precision of Money fields. When we ask the server to do the totals and sums of large number this precision helps. We never get rounding errors. For exaample 'SELECT SUM(FIELDMONEY) FROM SALESTABLE' ...