Skip to content

Commit

Permalink
ensure ALL_FIELDS for Add/Update will include only copiable fields
Browse files Browse the repository at this point in the history
(e.g. not TSQLRecordMany fields)
  • Loading branch information
Arnaud Bouchez committed Aug 24, 2018
1 parent 54a3f0c commit 5d3ea25
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
16 changes: 9 additions & 7 deletions SQLite3/mORMot.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions SynFPCLinux.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions SynLog.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion SynopseCommit.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
'1.18.4759'
'1.18.4761'

0 comments on commit 5d3ea25

Please sign in to comment.