Paul Ishenin wrote:
Paul Ishenin wrote:

I help to convert Fib+ library to FPC/Lazarus and this was one of the problems we found.

Found one more incompatibility - TField.SetAsVariant declaration is differ:


Sorry, I was impatient with sending first problems. I found more and this is the last patch since I compiled the whole library now :)

Patch fixed next incompatibilities:

TField:
1. make SetDataset virtual
2. pass SetVariant argument as const
3. add Lookup property

TDataset:
1. add SetDefaultFields protected method

I also cannot keep me from correcting wrong char case of few words like "AlignMent".

Best regards,
Paul Ishenin.
Index: packages/fcl-db/src/base/dataset.inc
===================================================================
--- packages/fcl-db/src/base/dataset.inc        (revision 11115)
+++ packages/fcl-db/src/base/dataset.inc        (working copy)
@@ -1177,6 +1177,11 @@
     end;
 end;
 
+procedure TDataSet.SetDefaultFields(const Value: Boolean);
+begin
+  FDefaultFields := Value;
+end;
+
 Procedure TDataset.SetField (Index : Longint;Value : TField);
 
 begin
Index: packages/fcl-db/src/base/db.pas
===================================================================
--- packages/fcl-db/src/base/db.pas     (revision 11115)
+++ packages/fcl-db/src/base/db.pas     (working copy)
@@ -257,8 +257,8 @@
   { TField }
 
   TField = class(TComponent)
-  Private
-    FAlignMent : TAlignment;
+  private
+    FAlignment : TAlignment;
     FAttributeSet : String;
     FCalculated : Boolean;
     FConstraintErrorMessage : String;
@@ -296,16 +296,17 @@
     FValidating : Boolean;
     FVisible : Boolean;
     FProviderFlags : TProviderFlags;
-    Function GetIndex : longint;
+    function GetIndex : longint;
+    function GetLookup: Boolean;
     procedure SetAlignment(const AValue: TAlignMent);
     procedure SetIndex(const AValue: Integer);
-    Procedure SetDataset(AValue : TDataset);
     function GetDisplayText: String;
     function GetEditText: String;
     procedure SetEditText(const AValue: string);
     procedure SetDisplayLabel(const AValue: string);
     procedure SetDisplayWidth(const AValue: Longint);
     function GetDisplayWidth: integer;
+    procedure SetLookup(const AValue: Boolean);
     procedure SetReadOnly(const AValue: Boolean);
     procedure SetVisible(const AValue: Boolean);
     function IsDisplayStored : Boolean;
@@ -350,9 +351,10 @@
     procedure SetAsLongint(AValue: Longint); virtual;
     procedure SetAsInteger(AValue: Integer); virtual;
     procedure SetAsLargeint(AValue: Largeint); virtual;
-    procedure SetAsVariant(AValue: variant); virtual;
+    procedure SetAsVariant(const AValue: variant); virtual;
     procedure SetAsString(const AValue: string); virtual;
     procedure SetAsWideString(const aValue: WideString); virtual;
+    procedure SetDataset(AValue : TDataset); virtual;
     procedure SetDataType(AValue: TFieldType);
     procedure SetNewValue(const AValue: Variant);
     procedure SetSize(AValue: Word); virtual;
@@ -406,7 +408,7 @@
     property OldValue: variant read GetOldValue;
     property LookupList: TLookupList read GetLookupList;
   published
-    property AlignMent : TAlignMent Read FAlignMent write SetAlignment default 
taLeftJustify;
+    property Alignment : TAlignment read FAlignment write SetAlignment default 
taLeftJustify;
     property CustomConstraint: string read FCustomConstraint write 
FCustomConstraint;
     property ConstraintErrorMessage: string read FConstraintErrorMessage write 
FConstraintErrorMessage;
     property DefaultExpression: string read FDefaultExpression write 
FDefaultExpression;
@@ -417,11 +419,12 @@
     property HasConstraints: Boolean read FHasConstraints;
     property Index: Longint read GetIndex write SetIndex;
     property ImportedConstraint: string read FImportedConstraint write 
FImportedConstraint;
+    property KeyFields: string read FKeyFields write FKeyFields;
+    property Lookup: Boolean read GetLookup write SetLookup;
+    property LookupCache: Boolean read FLookupCache write FLookupCache;
     property LookupDataSet: TDataSet read FLookupDataSet write FLookupDataSet;
     property LookupKeyFields: string read FLookupKeyFields write 
FLookupKeyFields;
     property LookupResultField: string read FLookupResultField write 
FLookupResultField;
-    property KeyFields: string read FKeyFields write FKeyFields;
-    property LookupCache: Boolean read FLookupCache write FLookupCache;
     property Origin: string read FOrigin write FOrigin;
     property ProviderFlags : TProviderFlags read FProviderFlags write 
FProviderFlags;
     property ReadOnly: Boolean read FReadOnly write SetReadOnly;
@@ -1203,6 +1206,7 @@
     procedure SetBufListSize(Value: Longint); virtual;
     procedure SetChildOrder(Component: TComponent; Order: Longint); override;
     procedure SetCurrentRecord(Index: Longint); virtual;
+    procedure SetDefaultFields(const Value: Boolean);
     procedure SetFiltered(Value: Boolean); virtual;
     procedure SetFilterOptions(Value: TFilterOptions); virtual;
     procedure SetFilterText(const Value: string); virtual;
Index: packages/fcl-db/src/base/fields.inc
===================================================================
--- packages/fcl-db/src/base/fields.inc (revision 11115)
+++ packages/fcl-db/src/base/fields.inc (working copy)
@@ -608,6 +608,11 @@
     Result:=-1;
 end;
 
+function TField.GetLookup: Boolean;
+begin
+  Result := FieldKind = fkLookup;
+end;
+
 function TField.GetAsLargeInt: LargeInt;
 begin
   Raise AccessError(SLargeInt);
@@ -742,7 +747,7 @@
   Raise AccessError(SFloat);
 end;
 
-procedure TField.SetAsVariant(AValue: Variant);
+procedure TField.SetAsVariant(const AValue: Variant);
 
 begin
   if VarIsNull(AValue) then
@@ -939,6 +944,13 @@
     result:=FDisplayWidth;
 end;
 
+procedure TField.SetLookup(const AValue: Boolean);
+const
+  ValueToLookupMap: array[Boolean] of TFieldKind = (fkData, fkLookup);
+begin
+  FieldKind := ValueToLookupMap[AValue];
+end;
+
 procedure TField.SetReadOnly(const AValue: Boolean);
 begin
   if (FReadOnly<>Avalue) then
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to