#1 2011-12-06 15:58:54

Sir Rufo
Member
Registered: 2011-10-14
Posts: 24

Update ModTime, CreateTime ReadOnly-Properties

As documented in the code

procedure SetInt64Prop(Instance: TObject; PropInfo: PPropInfo; const Value: Int64);
// AB: use the getter field address if no setter (no write attribute) exists

and with this

procedure TSQLRecord.ComputeFieldsBeforeWrite(aRest: TSQLRest; aOccasion: TSQLEvent);
var F: integer;
begin
  if (self<>nil) and (aRest<>nil) then
    with RecordProps do begin
      if HasModTimeFields then
        for F := 0 to high(FieldType) do
        if FieldType[f]=sftModTime then
          SetInt64Prop(Self,Fields[F],aRest.ServerTimeStamp);
      if HasCreateTimeField and (aOccasion=seAdd) then
        for F := 0 to high(FieldType) do
        if FieldType[f]=sftCreateTime then
          SetInt64Prop(Self,Fields[F],aRest.ServerTimeStamp);
    end;
end;

i would expect that this prop should have been updated by sending back to server:

TSQLMyRec = class( TSQLRecord )
private
  fModTime : TModTime;
published
  property ModTime : TModTime read fModTime;
end;

but the value will still be 0

Offline

#2 2011-12-07 06:56:59

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

Re: Update ModTime, CreateTime ReadOnly-Properties

You are right!

There was an issue with the SetInt64Prop() procedure which failed the update of a property with no explicit setter.

It is now fixed - and I've modified the regression tests to also check this particular pattern.
See http://synopse.info/fossil/info/eff2485f1d

Thanks for the report! smile

Offline

#3 2011-12-07 10:50:52

Sir Rufo
Member
Registered: 2011-10-14
Posts: 24

Re: Update ModTime, CreateTime ReadOnly-Properties

thanx a lot smile

Offline

Board footer

Powered by FluxBB