Problems with DATEs

Problems with DATEs

Postby Aggie85 » Fri 14 Jul 2017 03:06

Howdy Maxim!

I am trying to get an understand with TDate fields and I am getting very inconsistent results.

I have created two tables with a date field called EventDate and a time field called DepartTime.

One table is a TkbmMemTable and the other is a TVirtualTable.

I use the routine below to populate the two tables:

for (TDateTime nEventDate = TDateTime(2017,1,1); nEventDate <= TDateTime(2017,12,31); nEventDate = IncDay(nEventDate,1))
{
for (TDateTime nDepartTime = EncodeTime(12,0,0,0); nDepartTime <= EncodeTime(18,0,0,0); nDepartTime = IncHour(nDepartTime,2))
{
TestTable_->Insert();
TestTable_EventDate->Value = nEventDate;
TestTable_DepartTime->Value = nDepartTime;
TestTable_->Post();

TestVirtualTable_->Insert();
TestVirtualTable_EventDate->Value = nEventDate;
TestVirtualTable_DepartTime->Value = nDepartTime;
TestVirtualTable_->Post();
}
}

Each table has 1460 records (365 days / 4 hours per day).

If I execute the following statement against the TkbmMemTable:

DELETE FROM Test WHERE EventDate IN (DATE('2017-06-01'))

4 records are deleted as expected.

If I run the the following against the TkbmMemTable:

DELETE FROM Test WHERE EventDate NOT IN (DATE('2017-06-01'))

ALL records are deleted including the 4 that should NOT be deleted.

If I run either statement against the TVirtualTable, NO RECORDS ARE DELETED.

How do I get consistent date (and time) conditions? My program is a reservation system and dates / times are used extensively.

Well, I will hope for an answer when I wake up in the morning.

Thanks,

Aggie85
Aggie85
 
Posts: 66
Joined: Wed 11 Nov 2015 17:03

Re: Problems with DATEs

Postby Aggie85 » Fri 14 Jul 2017 13:53

Howdy Maxim,

In the latest nightly build you send me even the TkbmMemTable above DELETE that worked no longer works.

Everything I have tried against datasets that use Delphi's TDateTime format don't work with VirtualQuery.

I am dead in the water under you give me the magical guidance of what I am missing!

Thanks,

Aggie85
Aggie85
 
Posts: 66
Joined: Wed 11 Nov 2015 17:03

Re: Problems with DATEs

Postby MaximG » Fri 14 Jul 2017 14:33

Thank you for the information. The links for downloading a night build, which includes the fix of the described bug, were sent to your email
MaximG
Devart Team
 
Posts: 737
Joined: Mon 06 Jul 2015 11:34

Re: Problems with DATEs

Postby Aggie85 » Fri 14 Jul 2017 15:27

Howdy Maxim!

I have verified in my test code that the latest build fixes the aforementioned problem! I really appreciate the quick fix!

Have a great weekend!

Aggie85
Aggie85
 
Posts: 66
Joined: Wed 11 Nov 2015 17:03

Re: Problems with DATEs

Postby MaximG » Mon 17 Jul 2017 05:50

We are glad that we could find the solution, which helped to implement your projects.
MaximG
Devart Team
 
Posts: 737
Joined: Mon 06 Jul 2015 11:34


Return to VirtualDAC