FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TimeStamp data types from xharbour
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
TimeStamp data types from xharbour
Posted: Wed Oct 31, 2007 02:32 PM

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.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TimeStamp data types from xharbour
Posted: Wed Oct 31, 2007 04:16 PM

Reinaldo,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
TimeStamp data types from xharbour
Posted: Wed Oct 31, 2007 06:01 PM
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 ? :-)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TimeStamp data types from xharbour
Posted: Wed Oct 31, 2007 07:55 PM

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
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
TimeStamp data types from xharbour
Posted: Thu Nov 01, 2007 04:09 PM
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TimeStamp data types from xharbour
Posted: Thu Nov 01, 2007 09:29 PM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
TimeStamp data types from xharbour
Posted: Fri Nov 02, 2007 03:29 AM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
TimeStamp data types from xharbour
Posted: Fri Nov 02, 2007 03:33 AM
In the above example, we can simply say :
test->tstamp  := datetime() // or any other datetime variable
// for testing, check
msginfo( ttoc( test->tstamp ) )
Regards



G. N. Rao.

Hyderabad, India
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TimeStamp data types from xharbour
Posted: Fri Nov 02, 2007 08:38 AM

NageswaraRao,

Thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
TimeStamp data types from xharbour
Posted: Fri Nov 02, 2007 01:14 PM

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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
TimeStamp data types from xharbour
Posted: Fri Nov 02, 2007 01:18 PM

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

Continue the discussion