I removed InvalidGet method and object access to the property stopped working.
Class Utils.GlobalProp Extends %Persistent
{
Parameter InvalidGLVN = "^Utils.GlobalPropP";
Property Invalid As %String [ SqlComputeCode = {set {*} = ##class(Utils.GlobalProp).InvalidStatic()}, SqlComputed, Transient ];
ClassMethod InvalidStatic() As %String
{
Return $Get(@..#InvalidGLVN)
}
Method InvalidSet(val As %String) As %Status
{
Set @..#InvalidGLVN = val
Return $$$OK
}
/// Do ##class(Utils.GlobalProp).Test()
ClassMethod Test()
{
Do ..%KillExtent()
Set obj = ..%New()
Write "Invalid old: " _ obj.Invalid,!
Set obj.Invalid = $Random(100)
Write "Invalid new: " _ obj.Invalid,!
Do obj.%Save()
Kill obj
&sql(SELECT Invalid INTO :invalid FROM Utils.GlobalProp WHERE Id = 1)
Write "SQLCODE: " _ SQLCODE,!
Write "Invalid sql: " _ invalid,!
}Outputs:
Invalid old: Invalid new: SQLCODE: 0 Invalid sql: 65
Related Int code:
zInvalidCompute(%id)
New %tException,%val set %val = ""
try {
set %val = ##class(Utils.GlobalProp).InvalidStatic()
} catch %tException { throw %tException }
Quit %val
zInvalidGet() public {
If i%Invalid = "" { Set ..Invalid=..InvalidCompute($listget(i%"%%OID")) } Quit i%Invalid }
zInvalidSQLCompute()
// Compute code for field Invalid
set %d(2) = ##class(Utils.GlobalProp).InvalidStatic()
QUIT
Do $System.Status.DisplayError(tStatus)
Write !
}
Quit
}
}- Log in to post comments


