[fpc-devel] TField.IsNull for Interbase (or rather Firebird :) implemented
Michalis Kamburelis
michalis at camelot.homedns.org
Thu Mar 17 01:57:27 CET 2005
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 :)
Michalis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ibase60types.inc.patch
Type: text/x-patch
Size: 536 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050317/49e852b0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interbase.pp.patch
Type: text/x-patch
Size: 4361 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050317/49e852b0/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_interbase_isnull.pas
Type: text/x-pascal
Size: 1581 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050317/49e852b0/attachment.pas>
More information about the fpc-devel
mailing list