[fpc-devel] TField.IsNull for Interbase (or rather Firebird :) implemented

Michael Van Canneyt michael.vancanneyt at wisa.be
Thu Mar 17 10:04:01 CET 2005



On Thu, 17 Mar 2005, Michalis Kamburelis wrote:

> Hi
>
> I managed to implement correct TField.IsNull behaviour for fields inside 
> TIBQuery dataset. I'm attaching:
>
> -- patch to packages/base/ibase/ibase60types.inc, this fixes a small bug in 
> ibase60 unit that defined Short as Integer (= 32 bits, since ibase60 unit is 
> compiled in objfpc mode), while it should be 16 bits.
>
> -- patch to fcl/db/interbase/interbase.pp that
>
> 1) Fixes FFieldFlag declaration, it should be an array of IBase60.Short type 
> (16 bits, not 8-bits ShortInt type as it was).
>
> 2) Implements correct TField.IsNull behaviour by recording "IsNull" state of 
> each field of each record, along with data of that field. 
> ThenTIBQuery.GetFieldData can be modified to return correct value of IsNull, 
> and set Buffer^ only if field is not null and Buffer <> nil (since 
> TField.GetIsNull calls TField.GetData with Buffer = Nil, and this causes call 
> to FDataset.GetFieldData with Buffer = nil)
>
> 3) Oh, and small changes to TIBTransaction that I sent in my previous email 
> this day (publishing 4 properties) are also included in this patch. Sorry, 
> this was just easier for me, and since I didn't see them committed yet... 
> Anyway, these changes to TIBTransaction are absolutely not related to all 
> that "IsNull stuff", so feel free to cut them out if you don't like them.
>
> -- I'm also attaching a trivial program using Interbase unit and some testing 
> db to check that IsNull works as it should. Just in case it will save you 
> some time in testing my patch :)

Patch applied, thank you very much. I skipped the test, though.
Flames will be redirected to you ;)

Michael.




More information about the fpc-devel mailing list