This is code extracted from this project (note: reformatted for clarity):
Class Util.Data.EmojiType Extends %Persistent
{
Property CodePoint As %Integer;
Property UnicodeChar As %String [
Calculated,
ReadOnly,
SqlComputeCode = { set {*} = $wchar({CodePoint})},
SqlComputed,
Transient
];
// snip
Method UnicodeCharGet() As %String
{
quit $wchar(..CodePoint)
}
Now, I really don't get it. Why is it that UnicodeChar
is both Calculated and has a custom getter (ouch), plus the custom getter does exactly the same thing as the SqlComputeCode
?
And if I try and get this property, what part of all this will be triggered?
Custom getter can be called even if property is not Calculated. But works only in object access mode. And to get calculated value via SQL query, property should have defined all properties: Calculated, SqlComputed and SqlComputeCode. And in case where SqlComputeCode is defined, this code uses only in SQL query. When property has Calculated property, but not SqlComputed, it will not appear in SQL result.