Permalink
Browse files

ensure ALL_FIELDS for Add/Update will include only copiable fields

(e.g. not TSQLRecordMany fields)
  • Loading branch information...
Arnaud Bouchez
Arnaud Bouchez committed Aug 24, 2018
1 parent 54a3f0c commit 5d3ea25c7a6461312be2ea9548e71e3e5dcd5031
Showing with 16 additions and 14 deletions.
  1. +9 −7 SQLite3/mORMot.pas
  2. +2 −2 SynFPCLinux.pas
  3. +4 −4 SynLog.pas
  4. +1 −1 SynopseCommit.inc
@@ -35107,10 +35107,10 @@ function TSQLRestBatch.Update(Value: TSQLRecord;
if IsZero(CustomFields) then
Value.FillContext.ComputeSetUpdatedFieldBits(Props,FieldBits) else
if DoNotAutoComputeFields then
FieldBits := CustomFields else
FieldBits := CustomFields+Value.RecordProps.FieldBits[sftModTime];
FieldBits := CustomFields*Props.CopiableFieldsBits else
FieldBits := CustomFields*Props.CopiableFieldsBits+Props.FieldBits[sftModTime];
SetExpandedJSONWriter(Props,fTablePreviousSendData<>PSQLRecordClass(Value)^,
true,FieldBits);
{withID=}true,FieldBits);
fTablePreviousSendData := PSQLRecordClass(Value)^;
if not DoNotAutoComputeFields then
Value.ComputeFieldsBeforeWrite(fRest,seUpdate); // update sftModTime fields
@@ -36560,6 +36560,7 @@ procedure TSQLRest.GetJSONValuesForAdd(TableIndex: integer; Value: TSQLRecord;
ForceID, DoNotAutoComputeFields, WithBlobs: boolean;
CustomFields: PSQLFieldBits; var result: RawUTF8);
var fields: TSQLFieldBits;
props: TSQLRecordProperties;
begin
if not DoNotAutoComputeFields then // update TModTime/TCreateTime fields
Value.ComputeFieldsBeforeWrite(self,seAdd);
@@ -36573,13 +36574,14 @@ procedure TSQLRest.GetJSONValuesForAdd(TableIndex: integer; Value: TSQLRecord;
end else
if Value.fID=0 then
ForceID := false;
props := Value.RecordProps;
if CustomFields <> nil then
if DoNotAutoComputeFields then
fields := CustomFields^ else
fields := CustomFields^+Value.RecordProps.ComputeBeforeAddFieldsBits else
fields := CustomFields^*props.CopiableFieldsBits else
fields := CustomFields^*props.CopiableFieldsBits+props.ComputeBeforeAddFieldsBits else
if withBlobs then
fields := Value.RecordProps.CopiableFieldsBits else
fields := Value.RecordProps.SimpleFieldsBits[soInsert];
fields := props.CopiableFieldsBits else
fields := props.SimpleFieldsBits[soInsert];
if not ForceID and IsZero(fields) then
result := '' else
result := Value.GetJSONValues(true,ForceID,fields);
@@ -445,7 +445,7 @@ procedure GetKernelRevision;
end;
begin
if fpuname(uts)=0 then begin
P := @uts.release;
P := @uts.release[0];
KernelRevision := GetNext shl 16+GetNext shl 8+GetNext;
{$ifndef BSD}
if KernelRevision>=$020620 then begin // expects kernel 2.6.32 or higher
@@ -530,7 +530,7 @@ procedure SetUnixThreadName(ThreadID: TThreadID; const Name: RawByteString);
{$ifndef BSD}
ExternalLibraries.EnsureLoaded;
if Assigned(ExternalLibraries.pthread_setname_np) then
ExternalLibraries.pthread_setname_np(pointer(ThreadID), @trunc);
ExternalLibraries.pthread_setname_np(pointer(ThreadID), @trunc[0]);
{$endif}
end;
@@ -3456,8 +3456,8 @@ class function TSynLog.Add: TSynLog;
if result<>nil then begin // inlined TSynLog.Family (Add is already inlined)
result := PPointer(PtrInt(result)+vmtAutoTable)^;
if result=nil then
TSynLogFamily(result) := FamilyCreate;
result := TSynLogFamily(result).SynLog;
TSynLogFamily(pointer(result)) := FamilyCreate;
result := TSynLogFamily(pointer(result)).SynLog;
end;
end;
{$else}
@@ -3821,8 +3821,8 @@ class function TSynLog.Enter(aInstance: TObject; aMethodName: PUTF8Char;
end;
aSynLog := PPointer(PtrInt(aSynLog)+vmtAutoTable)^;
if aSynLog=nil then
TSynLogFamily(aSynLog) := FamilyCreate;
aSynLog := TSynLogFamily(aSynLog).SynLog;
TSynLogFamily(pointer(aSynLog)) := FamilyCreate;
aSynLog := TSynLogFamily(pointer(aSynLog)).SynLog;
// recursively store parameters
if sllEnter in aSynLog.fFamily.fLevel then begin
aSynLog.LockAndGetThreadContext;
@@ -1 +1 @@
'1.18.4759'
'1.18.4761'

0 comments on commit 5d3ea25

Please sign in to comment.