Storing dynamic object properties larger than 3641144 symbols
I have defined a class with a dynamic object property:
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.1
Is 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.
Product version: IRIS 2021.2
$ZV: IRIS for Windows (x86-64) 2021.2 (Build 617U) Thu Dec 9 2021 09:54:09 EST
A serious problem I also struggled with.
I think inside IRIS there is not much chance to get across the MAXSTRING limit.
A possible work-around could be the class below. In short, you work with your json property as intended, merely before saving the object, you save the json-property into a stream and after opening an instance, you restore the json-property from the the stream - that's all. The drawback, no SQL over the json property...
Some testing...
If your code uses obj.%Reload() then %OnReload() and %OnOpen() should contain the same code.
Great idea!
I'd only add check to prevent rewrite of a stream on every save unless the dynamic object was modified:
Improvements are always welcome... ;-)
The %GlobalCharacterStream class is deprecated (although I believe it will continue working.) You should consider replacing it with the %Stream.GlobalCharacter class.
Yeah, old habits never die...
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue