View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004826 | JEDI VCL | 00 JVCL Components | public | 2009-06-16 14:49 | 2009-08-13 14:21 |
Reporter | ZENsan | Assigned To | obones | ||
Priority | normal | Severity | block | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | 3.38 | |||
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. | ||||
|
Forgot to say... It is in Delphi 2009 :) |
|
Also affected Filtering.. Every place where is staement = ftString, but not in [ftString, ftWideString]. affect delphi 2009.. |
|
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;". |
|
Why is AnsiLowerCase wrong? For AnsiSameText/AnsiSameStr it is the missing SORT_STRINGSORT flag, but what's wrong with AnsiLowerCase? |
|
Maybe I am wrong.. As I remember AnsiSameStr get parameters AnsiString, not unicode string like field value can return in Delphi 2009. |
|
The "Ansi" prefix was kept for compatibility reasons in Delphi 2009. The functions accept "UnicodeString" instead of "AnsiString". |
|
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. |
|
Still doesnt work with ftWideString... Just need to add ftWideString in comparisions. |
|
at least for Delphi 2009... |
|
So, where does it need to be added? |
|
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 |
|
If we upgrde that if Field.DataType = ftString then for all version of delphi, then we need to handle there ftWideString separately |
|
I would really appreciate a patch file in TortoiseSVN format against the latest sources |
2009-07-22 14:06
|
JvMemoryDataset.diff (779 bytes)
--- D:/jvcl/run/JvMemoryDataset.pas �� �� 22 14:29:30 2009 +++ C:/Users/U7/Documents/RAD Studio/Projects/Agora/JvMemoryDataset.pas �� �� 22 15:00:12 2009 @@ -1,4 +1,4 @@ -{----------------------------------------------------------------------------- +{----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -1133,10 +1133,8 @@ begin CheckBrowseMode; if Filtered <> Value then - begin inherited SetFiltered(Value); - First; - end; + First; end else inherited SetFiltered(Value); |
2009-07-22 14:08
|
JvDBUtils.diff (2,410 bytes)
--- D:/jvcl/run/JvDBUtils.pas �� �� 22 14:29:31 2009 +++ C:/Users/U7/Documents/RAD Studio/Projects/Agora/JvDBUtils.pas �� �� 22 15:04:10 2009 @@ -1,4 +1,4 @@ -{----------------------------------------------------------------------------- +{----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -483,7 +483,7 @@ var S: string; begin - if Field.DataType = ftString then + if Field.DataType in [ftString{$IFDEF COMPILER11_UP}, ftWideString{$ENDIF}] then begin if Value = Null then Result := Field.IsNull @@ -598,7 +598,7 @@ Field := DataSet.FindField(FieldName); if Field = nil then Exit; - if Field.DataType = ftString then + if Field.DataType in [ftString{$IFDEF COMPILER11_UP}, ftWideString{$ENDIF}] then begin DataSet.DisableControls; BookMk := DataSet.GetBookmark; @@ -856,7 +856,7 @@ FieldValue := ''; DateValue := NullDate; Exact := Exact or not (FieldType in - [ftString, ftDate, ftTime, ftDateTime]); + [ftString, {$IFDEF COMPILER11_UP}ftWideString,{$ENDIF} ftDate, ftTime, ftDateTime]); if FieldType in [ftDate, ftTime, ftDateTime] then begin DateValue := StrToDateDef(Value, NullDate); @@ -870,7 +870,7 @@ if not (Exact or EmptyValue) then FieldValue := ReplaceStr(ReplaceStr(StrMaskSQL(FieldValue), '*', '%'), '?', '_'); - if FieldType = ftString then + if FieldType in [ftString{$IFDEF COMPILER11_UP}, ftWideString{$ENDIF}] then FieldValue := '''' + FieldValue + ''''; end; LogicOperator := Operator; @@ -880,7 +880,7 @@ LogicOperator := '=' else begin - if FieldType = ftString then + if FieldType in [ftString{$IFDEF COMPILER11_UP}, ftWideString{$ENDIF}] then LogicOperator := 'LIKE' else LogicOperator := '>='; @@ -905,7 +905,7 @@ S, Esc: string; begin Esc := ''; - if not Exact and (FieldType = ftString) then + if not Exact and (FieldType in [ftString{$IFDEF COMPILER11_UP}, ftWideString{$ENDIF}]) then begin S := ReplaceStr(ReplaceStr(ReplaceStr(Value, '/', '//'), '_', '/_'), '%', '/%'); |
|
I uploaded patch diff files for latest revision 12405 |
2009-07-22 14:13
|
JvDBUtils - last.diff (2,410 bytes)
--- D:/jvcl/run/JvDBUtils.pas �� �� 22 14:29:31 2009 +++ C:/Users/U7/Documents/RAD Studio/Projects/Agora/JvDBUtils.pas �� �� 22 15:09:12 2009 @@ -1,4 +1,4 @@ -{----------------------------------------------------------------------------- +{----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -483,7 +483,7 @@ var S: string; begin - if Field.DataType = ftString then + if Field.DataType in [ftString{$IFDEF COMPILER12_UP}, ftWideString{$ENDIF}] then begin if Value = Null then Result := Field.IsNull @@ -598,7 +598,7 @@ Field := DataSet.FindField(FieldName); if Field = nil then Exit; - if Field.DataType = ftString then + if Field.DataType in [ftString{$IFDEF COMPILER12_UP}, ftWideString{$ENDIF}] then begin DataSet.DisableControls; BookMk := DataSet.GetBookmark; @@ -856,7 +856,7 @@ FieldValue := ''; DateValue := NullDate; Exact := Exact or not (FieldType in - [ftString, ftDate, ftTime, ftDateTime]); + [ftString, {$IFDEF COMPILER12_UP}ftWideString,{$ENDIF} ftDate, ftTime, ftDateTime]); if FieldType in [ftDate, ftTime, ftDateTime] then begin DateValue := StrToDateDef(Value, NullDate); @@ -870,7 +870,7 @@ if not (Exact or EmptyValue) then FieldValue := ReplaceStr(ReplaceStr(StrMaskSQL(FieldValue), '*', '%'), '?', '_'); - if FieldType = ftString then + if FieldType in [ftString{$IFDEF COMPILER12_UP}, ftWideString{$ENDIF}] then FieldValue := '''' + FieldValue + ''''; end; LogicOperator := Operator; @@ -880,7 +880,7 @@ LogicOperator := '=' else begin - if FieldType = ftString then + if FieldType in [ftString{$IFDEF COMPILER12_UP}, ftWideString{$ENDIF}] then LogicOperator := 'LIKE' else LogicOperator := '>='; @@ -905,7 +905,7 @@ S, Esc: string; begin Esc := ''; - if not Exact and (FieldType = ftString) then + if not Exact and (FieldType in [ftString{$IFDEF COMPILER12_UP}, ftWideString{$ENDIF}]) then begin S := ReplaceStr(ReplaceStr(ReplaceStr(Value, '/', '//'), '_', '/_'), '%', '/%'); |
|
Please do not apply JvDBUtils.diff, but apply JvDBUtils-last.diff. I mixed up COMPILER12_UP with COMPILER12_UP, COMPILER12_UP is the right |
|
... I mixed up COMPILER11_UP with COMPILER12_UP, COMPILER12_UP is the right ... :) |
|
Diff files still will work with latest revision from SVN... |
|
Can someone check this patch? JvMemoryDataset.diff JvDBUtils - last.diff |
|
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+ ? |
|
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. |
|
And there is too much work for updating all the functions from string parameter... I think it is the correct way to change this. |
|
So? |
|
This is now in SVN |
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 |