You are not logged in.
Hi Arnaud,
XE7/8:
i get the following Exception loading a TSQLRecord derived Class A with Reference to TSQLRecord Class B
class B : TSQLRecord
value : RawUtf8;
...
end;
class A : TSQLRecord
value : RawUtf8;
FB : B;
...
end;
EJSONException mit Meldung 'JSONVariantData.Data(20<>JSONVariant)'. Prozess xyz.exe (896)
i use
var
LA : A;
begin
LA := A.Create(database, '*', 'value=?', ['test']); <- Exception;
The JSON which is parsed has the right TID at the right place.
Btu Resolving this Reference
with TVarData(JSONVariant) do
if VType=JSONVariantType.VarType then
result := @JSONVariant else
if VType=varByRef or varVariant then
result := JSONVariantData(PVariant(VPointer)^) else
raise EJSONException.CreateFmt('JSONVariantData.Data(%d<>JSONVariant)',[VType]);
raises the Exception. VType is 20 and JSONVariantType.VarType = 274
Last edited by itSDS (2015-02-18 15:01:50)
Rad Studio 12.1 Santorini
Offline
As a workaround i modified JSONVariantData
function JSONVariantData(const JSONVariant: variant): PJSONVariantData;
begin
with TVarData(JSONVariant) do
if (VType=JSONVariantType.VarType) or (VType=20) then
result := @JSONVariant else
if VType=varByRef or varVariant then
result := JSONVariantData(PVariant(VPointer)^) else
raise EJSONException.CreateFmt('JSONVariantData.Data(%d<>JSONVariant)',[VType]);
end;
this worked - But i think there is another way ...
Rad Studio 12.1 Santorini
Offline
After some Debugging: my workaround does not fix the Problem. Only the Exception is gone. But the Reference is not filled with the TID, it is nil
Ticket http://synopse.info/fossil/tktview/0ebc … c73b904712 created
Last edited by itSDS (2015-02-18 15:59:55)
Rad Studio 12.1 Santorini
Offline
Push - Hi Arnaud, i need this functionality. I can not load Data with CrossPlatform Client.
tyvm
Rad Studio 12.1 Santorini
Offline
Hi Arnaud i can not load TSQLRecord with Reference to other TSQLRecord as Pointer.
I think the main Problem is ARC.
I tried a little list with AddObject('entry1', TObject(1)); This doesn't work on iOS / Android either. Cause ARC tries de decrease RefCount of the 1
In TSQLRecord there will be the same Problem...
I'm thinking about removing the TSQLRecord Reference and replace it with TID for iOS / Android. Than it should work again.
Rad Studio 12.1 Santorini
Offline
I was not thinking about ARC, but you are right: it should be a true pointer, not an integer transtyped as fake pointer.
Yes, using TID should do the trick, at all levels: serialization (plain integer value), and ARC behavior.
Offline
is it possible to change the record reference in CrossPlatformwrapper to TID ? I don't want to change my TSQLRecord cause on other Platforms i wan't to use the Pointer.
it could be surounded with
if defined(AUTOREFCOUNT) ...
something like :
{$if defined(AUTOREFCOUNT)}TID{$else}TSQLDFLRecord{$endif}
Last edited by itSDS (2015-02-27 13:18:25)
Rad Studio 12.1 Santorini
Offline
Please try http://synopse.info/fossil/info/af10bf7303
No need to check for the compiler target: I just use TID for crossplatform clients, with a reference as comment to the original type declaration.
It is therefore up to the client code to use this TID as expected.
Offline
ty - now i can work with it. (But the BUG in the ticket is not fixed yet) it's just a workaround
Rad Studio 12.1 Santorini
Offline
In fact it is enough.
For the most cases i write interface functions.
Rad Studio 12.1 Santorini
Offline