TimeStamp data types from xharbour

Post Reply
User avatar
reinaldocrespo
Posts: 918
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

TimeStamp data types from xharbour

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Reinaldo,

Whats the size in bytes and the contents of a timestamp field in ADT ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Post 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 ? :-)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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 ) )
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

NageswaraRao,

Thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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' ...
Regards

G. N. Rao.
Hyderabad, India
Post Reply