You are not logged in.
Pages: 1
Hi,
I defined
TSQLMyFileInfo = class(TSQLRecord)
private
FMyFileDate: TDateTime;
FMyFileSize: int64;
procedure SetMyFileDate(const Value: TDateTime);
procedure SetMyFileSize(const Value: int64);
published
property MyFileDate: TDateTime read FMyFileDate write SetMyFileDate;
property MyFileSize: int64 read FMyFileSize write SetMyFileSize;
end;
but when I try to recover the stored data
var fo: TSQLMyFileInfo;
...
fo := TSQLMyFileInfo.Create(MyDataBase, aId);
I get an access violation (when setting the value of FMyFileSize).
As far as I have been able to trace, it gets the right value from the stored table and the value is correctly passed until procedure SetInt64Prop in SQLite3Commons. There it seems that the assembly code thinks the value is an address to read from.
Now I've changed the property type from Int64 to integer (more than enough for what I need) and have regenerated the tables and everything works fine. So, I guess it is a small bug (or may be I should give up programming and get some good english course )
Thanks a lot for answering so quickly.
I had already read "TSQLRecord published properties do not contain an instance of the TSQLRecord class" in the SAD but I did not fully understand it.
I am going to try it right now.
I want to compare two sets of files. A file (filename) may appear in just one set or in both of them. And, in this case, they may have the same size an modification date or not.
So, for every single file I have the following structure:
TSQLMyFileInfo = class(TSQLRecord)
private
FMyFileDate: TDateTime;
FMyFileSize: Int64;
procedure SetMyFileDate(const Value: TDateTime);
procedure SetMyFileSize(const Value: Int64);
published
property MyFileDate: TDateTime read FMyFileDate write SetMyFileDate;
property MyFileSize: Int64 read FMyFileSize write SetMyFileSize;
end;
TSQLMyFile = class(TSQLRecord)
private
FSecondOne: TSQLMyFileInfo;
FFirstOne: TSQLMyFileInfo;
FMyFileName: RawUTF8;
FMyFileInfo: TSQLMyFileInfo;
procedure SetFirstOne(const Value: TSQLMyFileInfo);
procedure SetMyFileName(const Value: RawUTF8);
procedure SetSecondOne(const Value: TSQLMyFileInfo);
procedure SetMyFileInfo(const Value: TSQLMyFileInfo);
published
property MyFileName: RawUTF8 read FMyFileName write SetMyFileName;
property FirstOne: TSQLMyFileInfo read FFirstOne write SetFirstOne;
property SecondOne: TSQLMyFileInfo read FSecondOne write SetSecondOne;
property MyFileInfo: TSQLMyFileInfo read FMyFileInfo write SetMyFileInfo;
end;
To save the "MyFile" object I do the following, after filling its properties:
MyDataBase.Add(MyFile.FirstOne, True);
MyDataBase.Add(MyFile.SecondOne, True);
MyDataBase.Add(MyFile, True);
But when I look into the table ("MyFile") I see it has saved the address of the objects (FirstOne, SecondOne) instead of their ids.
Could someone please tell me what am I doing wrong?
Thanks in advance
Pages: 1