#1 2011-07-19 11:07:13

JCano
Member
From: Spain
Registered: 2011-07-15
Posts: 3

Problem with Int64 type

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 sad)

Offline

#2 2011-07-19 11:22:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,492
Website

Re: Problem with Int64 type

The issue is because you're using a setter method SetMyFileSize().

I just checked with direct property handling, and it works fine:

property MyFileSize: int64 read FMyFileSize write FMyFileSize;

Offline

#3 2011-07-19 11:34:37

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,492
Website

Re: Problem with Int64 type

I fixed the issue in SetInt64Prop() with a setter method.
See http://synopse.info/fossil/info/d36c88fdb5

I've added the associated regression test.

Nice catch!
Thanks for the feedback. You won't have to give up programming. wink

Offline

Board footer

Powered by FluxBB