You are not logged in.
Pages: 1
Here a small sample project
unit View.Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls,
SynCommons, SQLite3Commons;
type
TMyItem = class( TCollectionItem )
private
fData : string;
published
property Data : string read fData write fData;
end;
TSQLTest = class( TSQLRecord )
private
fMyColl : TCollection;
public
constructor Create; override;
destructor Destroy; override;
published
property MyColl : TCollection read fMyColl;
end;
TForm1 = class( TForm )
Button1 : TButton;
procedure Button1Click( Sender : TObject );
private
public
end;
var
Form1 : TForm1;
implementation
{$R *.dfm}
{ TSQLTest }
constructor TSQLTest.Create;
begin
inherited;
fMyColl := TCollection.Create( TMyItem );
end;
destructor TSQLTest.Destroy;
begin
fMyColl.Free;
inherited;
end;
procedure TForm1.Button1Click( Sender : TObject );
var
RecSource, RecDest : TSQLTest;
begin
RecDest := TSQLTest.Create;
try
RecSource := TSQLTest.Create;
try
with TMyItem( RecSource.MyColl.Add ) do
begin
Data := 'Have a nice day';
end;
ShowMessage( IntToStr( RecSource.MyColl.Count ) ); // <- Shows 1
RecDest.FillFrom( RecSource );
finally
RecSource.Free;
end;
ShowMessage( IntToStr( RecDest.MyColl.Count ) ); // <- Access Violation!!
finally
RecDest.Free;
end;
end;
end.
Offline
The special case of TCollection was not handled in this case.
I've added this as you expected.
See http://synopse.info/fossil/info/0f0bc73310
Thanks for the report.
Offline
Thank u 4 the fix ... well done
Offline
Pages: 1