I have defined a class with a dynamic object property:
My class
Class test.Dyn Extends %Persistent
{
Property json As %DynamicObject;
/// do ##class(test.Dyn).test()
ClassMethod test()
{
do ..%KillExtent()
for len = 100, $$$MaxStringLength - 1, $$$MaxStringLength, $$$MaxStringLength+1, $$$MaxStringLength *2 {
set sc = ..save(len)
write "Len: ",len, " Result: ",$case($$$ISERR(sc), $$$YES: $System.Status.GetErrorText(sc), : "OK"),!
}
}
ClassMethod save(len)
{
set json = {}
set stream = ..getStream(len-8) // -8 because {"a":""}
do json.%Set("a", stream, "stream")
set obj = ..%New()
set obj.json = json
quit obj.%Save()
}
ClassMethod getStream(len)
{
set stream = ##class(%Stream.TmpCharacter).%New()
if len<$$$MaxStringLength {
do stream.Write($tr($j("",len)," ","A"))
} else {
for i=1:$$$MaxStringLength:len {
do stream.Write($tr($j("",$$$MaxStringLength)," ","A"))
}
do stream.Write($tr($j("",len-i)," ","A"))
}
quit stream
}
}The issue I encounter is that if a length of a serialized json property is more than 3641144 symbols, the object fails to save with the following error (either MAXSTRING or STRINGSTACK):
Length: 100 Result: OK
Length: 3641143 Result: OK
Length: 3641144 Result: OK
Length: 3641145 Result: ERROR #5002: ObjectScript error: <MAXSTRING>%GetSerial+1^%Library.DynamicAbstractObject.1
Length: 7282288 Result: ERROR #5002: ObjectScript error: <STRINGSTACK>%GetSerial+1^%Library.DynamicAbstractObject.1Is there a workaround? I need to store moderately large jsons (10-15 Mb) and dynamic object properties allow for a very convenient access.
$ZSTORAGE is set to -1.
.png)
.png)

.png)

.png)

.png)

