Browse Source

* Allow Nil owner for TFieldDefs (.Update method)
* TFieldDef.Create override, initializes FFieldNo.
Fixes MemDS streaming issue.

git-svn-id: trunk@8356 -

michael 18 years ago
parent
commit
825ac6ebe4
2 changed files with 10 additions and 1 deletions
  1. 1 0
      packages/fcl-db/src/db.pas
  2. 9 1
      packages/fcl-db/src/fields.inc

+ 1 - 0
packages/fcl-db/src/db.pas

@@ -182,6 +182,7 @@ type
     procedure SetSize(const AValue: Word);
     procedure SetSize(const AValue: Word);
     procedure SetRequired(const AValue: Boolean);
     procedure SetRequired(const AValue: Boolean);
   public
   public
+    constructor create(ACollection : TCollection); overload;
     constructor Create(AOwner: TFieldDefs; const AName: string;
     constructor Create(AOwner: TFieldDefs; const AName: string;
       ADataType: TFieldType; ASize: Word; ARequired: Boolean; AFieldNo: Longint); overload;
       ADataType: TFieldType; ASize: Word; ARequired: Boolean; AFieldNo: Longint); overload;
     destructor Destroy; override;
     destructor Destroy; override;

+ 9 - 1
packages/fcl-db/src/fields.inc

@@ -28,6 +28,13 @@ end;}
     TFieldDef
     TFieldDef
   ---------------------------------------------------------------------}
   ---------------------------------------------------------------------}
 
 
+Constructor TFieldDef.Create(ACollection : TCollection);
+
+begin
+  Inherited create(ACollection);
+  FFieldNo:=Index+1;
+end;
+
 Constructor TFieldDef.Create(AOwner: TFieldDefs; const AName: string;
 Constructor TFieldDef.Create(AOwner: TFieldDefs; const AName: string;
       ADataType: TFieldType; ASize: Word; ARequired: Boolean; AFieldNo: Longint);
       ADataType: TFieldType; ASize: Word; ARequired: Boolean; AFieldNo: Longint);
 
 
@@ -236,7 +243,8 @@ procedure TFieldDefs.Update;
 begin
 begin
   if not Updated then
   if not Updated then
     begin
     begin
-    DataSet.InitFieldDefs;
+    If Assigned(Dataset) then
+      DataSet.InitFieldDefs;
     Updated := True;
     Updated := True;
     end;
     end;
 end;
 end;