You are not logged in.
Pages: 1
Hi!
When i try to send an object with TSQLRecordMany properties through HTTP i've got an 406 (error execution failed (probably due to bad input parameters)).
What i've discovered is that in mormot.pas in the function JSONToObject :
tkClass: begin
if wasString or (P^.PropType^.ClassSQLFieldType<>sftID) then
exit; // should have been handled above
V := GetInteger(PropValue,err);
if err<>0 then
exit; // invalid value
P^.SetOrdProp(Value,V);
end;
In case of TSQLRecordMany the conditional expression P^.PropType^.ClassSQLFieldType <>sftID is true and the exit is executed and the function return false and this is why i've got the error.
I changed :
if wasString or (P^.PropType^.ClassSQLFieldType<>sftID) then
by
if wasString or ((P^.PropType^.ClassSQLFieldType<>sftID) and (P^.PropType^.ClassSQLFieldType<>sftMany)) then
and it's worked fine. What do you think?
Although when mORMot generate me the wrapper for crossplateform it wraps the TSQLRecordMany properties by Integer and not by TID. Is it good?
thx.
Offline
sftMany are never serialized, by design.
With a TSQLRecordMany field, no data is stored in the table itself, but in a separated pivot table.
Here you are serializing the pointer value of a remote TSQLRecord pivot instance in the TSQLRecordMany property, I'm afraid.
So it won't work as expected.
For SynCrossPlatform units, there is currently no support of TSQLRecordMany properties or class types.
Offline
Yeah it perfectly make sense!
I don't know why i wanted to add a pivot table properties.
Thanks for the quick answer.
Offline
Pages: 1