TimeStamp data types from xharbour

TimeStamp data types from xharbour

Postby reinaldocrespo » Wed Oct 31, 2007 2: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.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Postby Antonio Linares » Wed Oct 31, 2007 4:16 pm

Reinaldo,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marcelo Via Giglio » Wed Oct 31, 2007 6: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 ? :-)
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Postby Antonio Linares » Wed Oct 31, 2007 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marcelo Via Giglio » Thu Nov 01, 2007 4: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
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Postby Antonio Linares » Thu Nov 01, 2007 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby nageswaragunupudi » Fri Nov 02, 2007 3: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
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Fri Nov 02, 2007 3:33 am

In the above example, we can simply say :
Code: Select all  Expand view  RUN
test->tstamp  := datetime() // or any other datetime variable
// for testing, check
msginfo( ttoc( test->tstamp ) )
Regards

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

Postby Antonio Linares » Fri Nov 02, 2007 8:38 am

NageswaraRao,

Thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marcelo Via Giglio » Fri Nov 02, 2007 1: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
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Postby nageswaragunupudi » Fri Nov 02, 2007 1: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
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: antolin and 69 guests