InterSystems IRIS Data Platform 2019.2  /  Class Definition Reference  /  Property Keywords

Class Definition Reference
Previous section           Next section
InterSystems: The power behind what matters   

Specifies that a property is read-only, which limits the number of ways its value can be set.
To specify that the property is read-only, use the following syntax:
Property name As classname [ ReadOnly ];
Otherwise, omit this keyword or place the word Not immediately before the keyword.
Do not use the ReadOnly keyword with collection properties.
This keyword specifies that you cannot set the value of that property by using an object reference. If you attempt to set the value of a read-only property using an object reference, such as:
set oref.Name = "newvalue"
then there is a <CANNOT SET THIS PROPERTY> error at runtime.
Similarly, when a property is defined as read-only, the field in the corresponding SQL table is also defined as read-only. You cannot explicitly insert or update a read-only field via SQL statements. An attempt to do so results in an SQL error with an SQLCODE of -138.
You can specify the value of a read-only property in the following ways:
Note that each of these techniques has specific limitations.
If a property is marked as both read-only and required, note the following difference in behavior between object access and SQL access:
If you omit this keyword, the property is not read-only.
See Also

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-10-18 06:48:42