TVirtualQuery Bug With NULL TDateTime Fields

TVirtualQuery Bug With NULL TDateTime Fields

Postby Aggie85 » Thu 24 Aug 2017 22:13

Howdy!

If a dataset's TDate/TTime fields are set NULL fields and a TVirtualQuery statement is executed against the dataset, the untouched TDate/TTime NULL fields are set to 0 instead of setting the field's Variant value as NULL (Null()). Setting a TDate/TTime field to just 0 when it was a NULL value from the underlying source dataset causes the TField's IsNull property to return false instead of true and values in data-aware controls are shown as 12/30/1899 (Delphi NULL default value).

All the best,

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

Re: TVirtualQuery Bug With NULL TDateTime Fields

Postby MaximG » Mon 28 Aug 2017 08:55

Thank you for the message. Please explain which query you are executing when you get the described behavior. For this, compose and send us a small sample using the e-support form (https://www.devart.com - the "Support"\"Request Support" menu).
MaximG
Devart Team
 
Posts: 668
Joined: Mon 06 Jul 2015 11:34

Re: TVirtualQuery Bug With NULL TDateTime Fields

Postby Aggie85 » Fri 01 Sep 2017 16:53

Howdy Maxim!

I will put together a small demo to illustrate the bug.

Since I had to get my beta out, I just wrote my own wrapper class around TVirtualQuery that essentially replaced all source data sets BeforePost() events with a local one that checks all TDate/TTime fields with a value of 0. If the values are 0, I set the value to Null() which keeps the field's IsNull() method to True and then I call the previous BeforeEvent() for the dataset if there is one.

My solution adds very little overhead and allows me to fix these type of things quickly with no delay.

Have a great weekend,

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


Return to VirtualDAC