Migration problem going from TDACDSDataTable to TDAMemDataTable

1491
and yep it’ll be my problem

ok so 1491 works like 1463 in D10.3.3 (in regards to record position using MEM and loadfromremote)

but in D10.4.1 is behaves differently, so i have no clue why but in 10.4.1 the current rec in MEM becomes the loaded one… (in our app)
and i have no clue why…

I don’t see any significant changes in Data.DB.pas between 10.3.3 and 10.4.1 so they should work equally

i know and i really have no clue why
unless the optimised methods aren’t used
that is something i could check
maybe tomorrow :slight_smile:

have you seen - https://blogs.embarcadero.com/delphi-compiler-and-lsp-patch-for-rad-studio-10-4-1/ ?

yes but i don’t see how this is relevant?

nevertheless worth testing this out
maybe tomorrow :smiley:

according to Log in - Embarcadero Technologies :

so this could be affected to all ancestor/descendants classes …

hi EvgenyK,
another problem detected when going live:

tdaMEM.filter := ‘(pst_prd_Primkey=200784) and (pst_Verkocht=1)’
now pst_verkocht is a boolean field

it seems that tdaMEM does not handle =1 for boolean but requires =true (when the filter is active then i have 0 records with =1, when i change it to =true i have 1 rec like i should)

this is with .1463 release

can you confirm that this is indeed a problem?
this is a huge showstopper for me…

Hi,

Can you create a simple testcase that reproduces this, pls?
I’ll test it with .1463 and .1495 and see what was changed

here goes, run the included script
load some recs, then filter on bool button
filtering on bool=1 results in 0 records
VCLApplication2.rar (122.5 KB)

included script is not correct, use this;

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
drop table rotest
go

CREATE TABLE [dbo].[rotest](
[primkey] [int] IDENTITY(1,1) NOT NULL,
[filterkey] [int] NULL,
[data] nvarchar NULL,
[bool] [bit] null
) ON [PRIMARY]

GO
INSERT INTO [dbo].[rotest]
([data], [bool])
VALUES
(‘1’,1),(‘2’,1),(‘3’,1),(‘4’,1),(‘5’,1),(‘6’,1),(‘7’,1),(‘8’,1),(‘9’,1)
GO

tested against .1489 and the same result
it seems that filter on bool=1 is not supported on tdaMEM?

I’ll add this article to DA docs site a bit later

I’m not seeing boolean field filtering?
And so mem behaves differently than cds right?

Verstuurd mobiel

Hi,

we compare values as variants, so True becomes -1:

as a result, you have 1 = -1 when compare (1 = True).

I’ll add a special define that will allow to use 1 for True values

Thanks, logged as bugs://85170

can i somewhere patch the code to see what gives?

Hi,

you can try to patch uDAMemDataset.pas:

function TDAMemoryDataset.GetVarValueFromBuffer(const Buffer: TBytes;
  const FldIdx: Integer): variant;
..
        ftBoolean: Result := TDADBSupport.BufferToBoolean(Buffer, FOffsets[fldidx]); //<<<<<

and set 1 for True and 0 for False

Note: it could be a workaround. I didn’t touch this issue yet.

i don’t think this is the best way as it will probably break something else
i would expect the filter procedure to do the math… changing 1 to variant(true)?