Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004826 [JEDI VCL] 00 JVCL Components block always 2009-06-16 14:49 2009-08-13 14:21
Reporter ZENsan View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0004826: JvMemoryData when used as lookup source fails to locate key (TDBLookupComboBox) FIX provided
Description JvMemoryData when used as lookup source fails to locate key (TDBLookupComboBox)

JvDBUtils.pas:
  function CompareField(var Field: TField; Value: Variant): Boolean; {BG}
  var
    S: string;
  begin
    if Field.DataType = ftString then
    ...
We need to change this to:

    if Field.DataType in [ftString, ftWideString] then

And also WHY JvDBUtils.pas uses AnsiSameStr, AnsiLowercase with string type everywhere, when we MUST use SameStr and Lowercase. (Just because it is wrong in Delphi 2009).
Additional Information Hope you will include this fix soon.
Tags No tags attached.
Attached Files ? file icon JvMemoryDataset.diff [^] (779 bytes) 2009-07-22 14:06
? file icon JvDBUtils.diff [^] (2,410 bytes) 2009-07-22 14:08
? file icon JvDBUtils - last.diff [^] (2,410 bytes) 2009-07-22 14:13

- Relationships

-  Notes
(0015687)
ZENsan (reporter)
2009-06-16 14:49

Forgot to say... It is in Delphi 2009 :)
(0015688)
ZENsan (reporter)
2009-06-16 15:13

Also affected Filtering.. Every place where is staement = ftString, but not in [ftString, ftWideString]. affect delphi 2009..
(0015689)
ZENsan (reporter)
2009-06-16 15:38

JvMemoryDataset.pas:
procedure TJvMemoryData.SetFiltered(Value: Boolean);
begin
  if Active then
  begin
    CheckBrowseMode;
    if Filtered <> Value then
    begin
      inherited SetFiltered(Value);
      First;
    end;
  end
  else
    inherited SetFiltered(Value);
end;

But MUST be (like in TBDETable) this way:

procedure TJvMemoryData.SetFiltered(Value: Boolean);
begin
  if Active then
  begin
    CheckBrowseMode;
    if Filtered <> Value then
      inherited SetFiltered(Value);
    First;
  end
  else
    inherited SetFiltered(Value);
end;

The original CodeGear code is:

procedure TBDEDataSet.SetFiltered(Value: Boolean);
begin
  if Active then
  begin
    CheckBrowseMode;
    if Filtered <> Value then
    begin
      DestroyLookupCursor;
      DbiSetToBegin(FHandle);
      if Value then ActivateFilters else DeactivateFilters;
      inherited SetFiltered(Value);
    end;
    First;
  end else
    inherited SetFiltered(Value);
end;

There you see that "First;" goes after "end;".
(0015691)
AHUser (developer)
2009-06-16 19:16

Why is AnsiLowerCase wrong? For AnsiSameText/AnsiSameStr it is the missing SORT_STRINGSORT flag, but what's wrong with AnsiLowerCase?
(0015693)
ZENsan (reporter)
2009-06-16 19:57

Maybe I am wrong.. As I remember AnsiSameStr get parameters AnsiString, not unicode string like field value can return in Delphi 2009.
(0015694)
AHUser (developer)
2009-06-16 20:11

The "Ansi" prefix was kept for compatibility reasons in Delphi 2009. The functions accept "UnicodeString" instead of "AnsiString".
(0015698)
ZENsan (reporter)
2009-06-17 08:04

The main problem that (1) Filtering and (2) Locate do not work with ftWideString, because this type is just not included in comparision as I described in Description.
(3) And Filter := True must refilter data (like in all TTable components which I know), but JvMemoryData do not do this because of - my comment above.

So 3 problems which are easy to fix.
(0015772)
ZENsan (reporter)
2009-07-07 12:35

Still doesnt work with ftWideString...
Just need to add ftWideString in comparisions.
(0015773)
ZENsan (reporter)
2009-07-07 12:36

at least for Delphi 2009...
(0015803)
obones (administrator)
2009-07-09 13:41

So, where does it need to be added?
(0015861)
ZENsan (reporter)
2009-07-17 17:02

JvDBUtils.pas:
  if Field.DataType = ftString then

These lines for D2009 must be
  if Field.DataType in [ftString, ftWideString] then

And also read 3rd comment
(0015862)
ZENsan (reporter)
2009-07-17 17:02

If we upgrde that
  if Field.DataType = ftString then
for all version of delphi, then we need to handle there ftWideString separately
(0015868)
obones (administrator)
2009-07-21 11:15

I would really appreciate a patch file in TortoiseSVN format against the latest sources
(0015874)
ZENsan (reporter)
2009-07-22 14:09

I uploaded patch diff files for latest revision 12405
(0015875)
ZENsan (reporter)
2009-07-22 14:14

Please do not apply JvDBUtils.diff, but apply JvDBUtils-last.diff.

I mixed up COMPILER12_UP with COMPILER12_UP, COMPILER12_UP is the right
(0015877)
ZENsan (reporter)
2009-07-22 14:28

...
I mixed up COMPILER11_UP with COMPILER12_UP, COMPILER12_UP is the right
...
:)
(0015895)
ZENsan (reporter)
2009-07-30 08:20

Diff files still will work with latest revision from SVN...
(0015897)
ZENsan (reporter)
2009-08-03 08:24

Can someone check this patch?

JvMemoryDataset.diff
JvDBUtils - last.diff
(0015900)
obones (administrator)
2009-08-04 09:35

JvMemoryDataset is in.
But JvDBUtils got me thinking: ftWideString is not a new value in D2009, it existed long before. So why limit it to D2009+ ?
(0015914)
ZENsan (reporter)
2009-08-04 15:01

Because only in Delphi 2009 working with ftWideString is acceptable. because functions uses method AsString, and this method in Delphi prior to Delphi 2009 for field ftWideString will return ??? marks for unicode symbols.

I think it is not so good...
Maybe I am wrong.
(0015916)
ZENsan (reporter)
2009-08-04 15:06

And there is too much work for updating all the functions from string parameter...

I think it is the correct way to change this.
(0015990)
ZENsan (reporter)
2009-08-13 13:22

So?
(0015992)
obones (administrator)
2009-08-13 14:21

This is now in SVN

- Issue History
Date Modified Username Field Change
2009-06-16 14:49 ZENsan New Issue
2009-06-16 14:49 ZENsan Note Added: 0015687
2009-06-16 15:13 ZENsan Note Added: 0015688
2009-06-16 15:38 ZENsan Note Added: 0015689
2009-06-16 19:16 AHUser Note Added: 0015691
2009-06-16 19:16 AHUser Status new => feedback
2009-06-16 19:57 ZENsan Note Added: 0015693
2009-06-16 20:11 AHUser Note Added: 0015694
2009-06-17 08:04 ZENsan Note Added: 0015698
2009-07-07 12:35 ZENsan Note Added: 0015772
2009-07-07 12:36 ZENsan Note Added: 0015773
2009-07-09 13:41 obones Note Added: 0015803
2009-07-17 17:02 ZENsan Note Added: 0015861
2009-07-17 17:02 ZENsan Note Added: 0015862
2009-07-21 11:15 obones Note Added: 0015868
2009-07-22 14:06 ZENsan File Added: JvMemoryDataset.diff
2009-07-22 14:08 ZENsan File Added: JvDBUtils.diff
2009-07-22 14:09 ZENsan Note Added: 0015874
2009-07-22 14:13 ZENsan File Added: JvDBUtils - last.diff
2009-07-22 14:14 ZENsan Note Added: 0015875
2009-07-22 14:28 ZENsan Note Added: 0015877
2009-07-30 08:20 ZENsan Note Added: 0015895
2009-08-03 08:24 ZENsan Note Added: 0015897
2009-08-04 09:35 obones Note Added: 0015900
2009-08-04 15:01 ZENsan Note Added: 0015914
2009-08-04 15:06 ZENsan Note Added: 0015916
2009-08-13 13:22 ZENsan Note Added: 0015990
2009-08-13 14:21 obones Note Added: 0015992
2009-08-13 14:21 obones Status feedback => resolved
2009-08-13 14:21 obones Fixed in Version => Daily / SVN
2009-08-13 14:21 obones Resolution open => fixed
2009-08-13 14:21 obones Assigned To => obones


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker