Bit field locate/filter on true/1 fails in TClientDataSet

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Freerk
Posts: 3
Joined: Fri 23 Jan 2009 17:38

Bit field locate/filter on true/1 fails in TClientDataSet

Post by Freerk » Fri 23 Jan 2009 17:47

Hello,

We are using the TClientDataSet -> Provider -> TMSSQLQuery setup in Delphi 6.
Column of type "Bit" shows True/False ok in dataset, but locate and lookup and filter methods fail (no results) when searching/filtering for "True" or "1" values, even though there are many rows with "True" in this column. Searching/filtering for "False" or "0" works ok.


Regards,
Freerk Jelsma
SchoolMaster BV

Freerk
Posts: 3
Joined: Fri 23 Jan 2009 17:38

Post by Freerk » Fri 23 Jan 2009 19:17

I've found out it writes the data as -1 for true and 0 for false, so I've made a quick fix myself in OLEDBAcess.pas in the inline function PrepareConvertableFields of Fetch.

dtBoolean:
if Boolean(WordBool(Marshal.ReadInt16(pValue))) then
Marshal.WriteInt16(pValue, 1)

So now I write 1 instead of -1.
TClientDataSet works fine with this quick fix.

Any comments?


Regards,
Freerk Jelsma
SchoolMaster BV

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 03 Feb 2009 10:31

We can't apply this fix because standard Delphi dataset keeps "True" boolean value as the WordBool value equal to $FF. Even ADO has similar behaviour.

Post Reply