From: Enrique E. <the...@us...> - 2005-11-06 20:37:19
|
Update of /cvsroot/instantobjects/Source/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24701/Core Modified Files: InstantDBBuild.pas InstantPersistence.pas Log Message: Added Assign method to metadata classes and test support to that methods Index: InstantPersistence.pas =================================================================== RCS file: /cvsroot/instantobjects/Source/Core/InstantPersistence.pas,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** InstantPersistence.pas 31 Oct 2005 23:43:38 -0000 1.71 --- InstantPersistence.pas 6 Nov 2005 20:37:11 -0000 1.72 *************** *** 286,289 **** --- 286,290 ---- public constructor Create(ACollection: TInstantFieldMetadatas); reintroduce; + procedure Assign(Source: TPersistent); override; // Returns True if one of the data types of Other (Other.DataType and // Other.AlternateDataTypes) equals one of the data types of Self. *************** *** 331,334 **** --- 332,336 ---- public constructor Create(ACollection: TInstantMetadatas); reintroduce; + procedure Assign(Source: TPersistent); override; property Collection: TInstantIndexMetadatas read GetCollection; // Returns True if the field identified by AFieldMetadata is part of this *************** *** 371,374 **** --- 373,377 ---- public destructor Destroy; override; + procedure Assign(Source: TPersistent); override; property Scheme: TInstantScheme read GetScheme; published *************** *** 3753,3756 **** --- 3756,3772 ---- { TInstantFieldMetadata } + procedure TInstantFieldMetadata.Assign(Source: TPersistent); + begin + inherited; + if Source is TInstantFieldMetadata then + with TInstantFieldMetadata(Source) do + begin + Self.FDataType := FDataType; + Self.FAlternateDataTypes := FAlternateDataTypes; + Self.FOptions := FOptions; + Self.FSize := FSize; + end; + end; + constructor TInstantFieldMetadata.Create(ACollection: TInstantFieldMetadatas); begin *************** *** 3836,3839 **** --- 3852,3866 ---- { TInstantIndexMetadata } + procedure TInstantIndexMetadata.Assign(Source: TPersistent); + begin + inherited; + if Source is TInstantIndexMetadata then + with TInstantIndexMetadata(Source) do + begin + Self.FFields := FFields; + Self.FOptions := FOptions; + end; + end; + constructor TInstantIndexMetadata.Create(ACollection: TInstantMetadatas); begin *************** *** 3945,3948 **** --- 3972,3986 ---- { TInstantTableMetadata } + procedure TInstantTableMetadata.Assign(Source: TPersistent); + begin + inherited; + if Source is TInstantTableMetadata then + with TInstantTableMetadata(Source) do + begin + Self.FieldMetadatas.Assign(FieldMetadatas); + Self.IndexMetadatas.Assign(IndexMetadatas); + end; + end; + destructor TInstantTableMetadata.Destroy; begin Index: InstantDBBuild.pas =================================================================== RCS file: /cvsroot/instantobjects/Source/Core/InstantDBBuild.pas,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** InstantDBBuild.pas 2 Nov 2005 18:49:48 -0000 1.11 --- InstantDBBuild.pas 6 Nov 2005 20:37:11 -0000 1.12 *************** *** 1037,1045 **** begin Result := TInstantFieldMetadata.Create(FieldMetadata.Collection); Result.Name := FieldMetadata.Name + STmpFieldSuffix; - Result.DataType := FieldMetadata.DataType; - Result.AlternateDataTypes := FieldMetadata.AlternateDataTypes; - Result.Options := FieldMetadata.Options; - Result.Size := FieldMetadata.Size; end; --- 1037,1042 ---- begin Result := TInstantFieldMetadata.Create(FieldMetadata.Collection); + Result.Assign(FieldMetadata); Result.Name := FieldMetadata.Name + STmpFieldSuffix; end; |