#1 2014-05-16 22:40:46

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

TRecordReference and Datetime

Hi,
first of all : thanks for your great job !

I'm trying to understand how it works....

I've two questions.

TRecordReference : perhaps a limit of 64 tables could be few for some projects. Could be used an int64 instead of a 32 bits reference ?

TTimelog is certainly good in most cases but... why db date and time data types are not supported at all ?

Thank you.
kind regards

Mario

Offline

#2 2014-05-17 06:53:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: TRecordReference and Datetime

TRecordReference: why not?

TDateTime is also supported on Delphi side, and will use the native DB date and time.

Offline

#3 2014-05-20 05:21:03

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: TRecordReference and Datetime

TDatetime.
Perhaps I haven't correctly understood 5.1.2 of SAD : "Delphi TDateTime properties will be stored as ISO 8601 text in the database".
What are the delphi published property that the framework threats as a DB date , time or timestamp ? (In some cases I need milliseconds).

Offline

#4 2014-05-20 06:32:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: TRecordReference and Datetime

For external databases, TDateTime will be stored as native DB date/time.
For the SQlite3 internal engine, it will be stored as ISO 8601 text.

But the time value is ranged to the second.

What you can do is use your own time type, e.g.

type TPrecDateTime = TDateTime;

Which will be stored as double in the DB, with resolution up to the millisecond.

Offline

#5 2014-05-20 08:14:31

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: TRecordReference and Datetime

Thank you very much.
Mario

Offline

#6 2014-10-23 06:22:19

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: TRecordReference and Datetime

Hi AB,
I'm beginning to know a bit more your fantastic framework and have a question about ID field : it is defined as Integer.
As stated in doc, in sqlite it is an int64 , but in delphi , AFAIK, it is an int32.
One of my tables will grow till int32 capability in short time (few years I suppose) : is it possible , or planned, to use an int64 for the id property ?

Offline

#7 2014-10-23 07:48:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: TRecordReference and Datetime

As explained in the doc, the ID field has to map a pointer/TSQLRecord, so that it would be referenced for one-to-one or one-to-many relationship as TSQLRecord published properties.
This is the reason why it should be an Int32.

If you use RecordReference, there is a limitation to 2^24 rows, by design.
But not for plain IDs.

I honestly doubt you would have more than 2^32 rows in your table.
The SQlite3 or external database would be stucked before.

Offline

#8 2014-10-24 21:53:50

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: TRecordReference and Datetime

Yes AB,
i'll not maintain 2^32 rows in db, because i'll reorganize the table periodically, so there will be on line much less records, but the id will increase.
Perhaps restart from zero will not be a problem , because the id will not have a refererence on other tables.
The fact is that we are using up to 64 bit to store values,  without having the opportunity to reuse them.

Offline

Board footer

Powered by FluxBB