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…
EvgenyK
(Evgeny Karpov)
November 10, 2020, 3:20pm
63
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
EvgenyK
(Evgeny Karpov)
November 10, 2020, 3:27pm
65
have you seen - https://blogs.embarcadero.com/delphi-compiler-and-lsp-patch-for-rad-studio-10-4-1/ ?
This patch addresses two issues in the Delphi 10.4.1 compiler: a data layout issue with specific alignments, logged in Quality Portal as RSP-30890 and RSP-30787, and a performance issue when recompiling, logged as RSP-22074, RSP-30714, and RSP-30627.
yes but i don’t see how this is relevant?
nevertheless worth testing this out
maybe tomorrow
EvgenyK
(Evgeny Karpov)
November 10, 2020, 3:32pm
68
according to Log in - Embarcadero Technologies :
This is a problem because of this situation:
Base class ends with field A. Derived class opens with field B. They are layed in memory as such:
B
A
In my test case, A is a pointer and B is a string. So @B should be @A + 4. In reality, @B is @A + 1. Whenever the code writes to A, it also partially overwrites B.
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…
EvgenyK
(Evgeny Karpov)
November 13, 2020, 12:31pm
70
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?
EvgenyK
(Evgeny Karpov)
November 13, 2020, 2:54pm
74
I’ll add this article to DA docs site a bit later
TDAMemDataTable Filters
To create a filter using the Filter property, set the value of the property to a string that contains the filter’s test condition. For example, the following statement creates a filter that tests a dataset’s State field to see if it contains a value for the state of California
:
table.Filter := 'State = ' + QuotedStr('CA');
You can also supply a value for Filter
based on text supplied by the user.
For example, the following statement assigns the text from edit box to Filter
:
table.Filter := Edit1.Text;
You can, of course, create a string based on both hard-coded text and user-supplied data:
table.Filter := 'State = ' + QuotedStr(Edit1.Text);
Note: After you specify a value for `Filter`, to apply the filter to the `TDAMemDataTable`, set the `Filtered` property to `True`.
Filters can compare field values to literals and to constants using the following comparison and logical operators:
Boolean operators
Operator
Meaning
Usage
AND
Tests two statements that both have to be True
(fld1 > 10) AND
(fld1 < 30)
NOT
Tests one statement that has to be not True
NOT
(fld1 = 10)
OR
Tests that at least one of two statements is True
(fld1 = 11) OR
(fld1 = 5)
XOR
Tests that at least one of two statements is not equal to the other one
(fld1 = 11) XOR
(fld2 = 5)
Comparing operations
Operator
Meaning
Usage
<
Less than
fld1 < 10
>
Greater than
fld1 > 10
>=
Greater than or equal to
fld1 >= 10
<=
Less than or equal to
fld1 <= 10
=
Equal to
fld1 = 10
<>
Not equal to
fld1 <> 10
IS NULL
Test values for NULL
fld1 IS NULL
IS NOT NULL
Test values for NOT NULL
fld1 IS NOT NULL
IN
Tests values from specified list
fld1 IN
(10,20)
LIKE
Finds a string fitting a certain description
fld1 LIKE
‘a*’ fld1 LIKE
‘%a’
Logical operators and math symbols
Operator
Meaning
Usage
AND
bitwise and
(fld1
AND 10) = 10
NOT
bitwise negation
(NOT
fld1) = 31
OR
bitwise or
(fld1 OR
10) = 40
XOR
bitwise xor
(fld1 XOR
10) = 0
+
addition
(fld1 + 10) = 30
-
subtraction
(fld1 - 10) = 10
*
multiplication
(fld1 * 10) < 30
/
real division
(fld1 / 10) > 10
$
specifies that value in hex format
(fld1 + $10) < 100
Wildcards for partial comparisons for LIKE operator
Operator
Usage
*
fld1 LIKE
‘abc*abc’
%
fld1 LIKE
‘%abc%’
By using combinations of these operators, you can create fairly sophisticated filters. For example, the following statement checks to make sure that two test conditions are met before accepting a record for display:
(fld1 > 1400) AND (fld1 < 1500)
Note: When filtering is on, user edits to a record may mean that the record no longer meets a filter's test conditions. The next time the record is retrieved from the `TDAMemDataTable`, it may therefore "disappear." If that happens, the next record that passes the filter condition becomes the current record.
I’m not seeing boolean field filtering?
And so mem behaves differently than cds right?
Verstuurd mobiel
EvgenyK
(Evgeny Karpov)
November 16, 2020, 9:06am
76
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?
EvgenyK
(Evgeny Karpov)
November 17, 2020, 9:41am
79
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)?