Sample.Person
persistent class Sample.Person extends %Library.Persistent, %Library.Populate, %XML.Adaptor
SQL Table Name: Sample.Person
This sample persistent class represents a person.Maintenance note: This class is used by some of the bindings samples.
Property Inventory
Method Inventory
- Addition()
- CurrentAge()
- NinetyNine()
- PrintPerson()
- PrintPersons()
- PrintPersonsSQL()
- StoredProcTest()
- UpdateProcTest()
Parameters
parameter EXTENTQUERYSPEC = Name,SSN,Home.City,Home.State;
Inherited description: The EXTENTQUERYSPEC parameter defines the properties to be retrieved in
addition to the IDKEY value for the built-in Extent query.
Persistent classes should define a value of for EXTENTQUERYSPEC if they wish to include additional properties in their built-in Extent query.
For example:
parameter EXTENTQUERYSPEC = "Name,SSN,Age";
Properties
property Age as %Integer [ Calculated ];
Person's age.
This is a calculated field whose value is derived from DOB.
This is a calculated field whose value is derived from DOB.
Property methods: AgeCompute(), AgeDisplayToLogical(), AgeGet(), AgeIsValid(), AgeLogicalToDisplay(), AgeNormalize(), AgeSQLCompute(), AgeXSDToLogical()
property DOB as %Date (POPSPEC = "Date()");
Person's Date of Birth.
Property methods: DOBDisplayToLogical(), DOBGet(), DOBGetStored(), DOBIsValid(), DOBLogicalToDisplay(), DOBLogicalToOdbc(), DOBLogicalToXSD(), DOBNormalize(), DOBOdbcToLogical(), DOBSet(), DOBXSDToLogical()
property FavoriteColors as list of %String (JAVATYPE = "java.util.List", POPSPEC = "ValueList("",Red,Orange,Yellow,Green,Blue,Purple,Black,White""):2");
A collection of strings representing the person's favorite colors.
Property methods: FavoriteColorsBuildValueArray(), FavoriteColorsCollectionToDisplay(), FavoriteColorsCollectionToOdbc(), FavoriteColorsDisplayToCollection(), FavoriteColorsDisplayToLogical(), FavoriteColorsGet(), FavoriteColorsGetObject(), FavoriteColorsGetObjectId(), FavoriteColorsGetStored(), FavoriteColorsGetSwizzled(), FavoriteColorsIsValid(), FavoriteColorsLogicalToDisplay(), FavoriteColorsLogicalToOdbc(), FavoriteColorsNormalize(), FavoriteColorsOdbcToCollection(), FavoriteColorsSet(), FavoriteColorsSetObject(), FavoriteColorsSetObjectId()
property Home as Address;
Person's home address. This uses an embedded object.
Property methods: HomeGet(), HomeGetObject(), HomeGetObjectId(), HomeGetStored(), HomeGetSwizzled(), HomeIsEmpty(), HomeIsValid(), HomeNewObject(), HomeSet(), HomeSetObject(), HomeSetObjectId(), HomeUnSwizzle()
property Name as %String (POPSPEC = "Name()") [ Required ];
Person's name.
Property methods: NameDisplayToLogical(), NameGet(), NameGetStored(), NameIsValid(), NameLogicalToDisplay(), NameLogicalToOdbc(), NameNormalize(), NameSet()
property Office as Address;
Person's office address. This uses an embedded object.
Property methods: OfficeGet(), OfficeGetObject(), OfficeGetObjectId(), OfficeGetStored(), OfficeGetSwizzled(), OfficeIsEmpty(), OfficeIsValid(), OfficeNewObject(), OfficeSet(), OfficeSetObject(), OfficeSetObjectId(), OfficeUnSwizzle()
property SSN as %String (PATTERN = "3N1""-""2N1""-""4N") [ Required ];
Person's Social Security number. This is validated using pattern match.
Property methods: SSNDisplayToLogical(), SSNGet(), SSNGetStored(), SSNIsValid(), SSNLogicalToDisplay(), SSNLogicalToOdbc(), SSNNormalize(), SSNSet()
property Spouse as Person;
Person's spouse. This is a reference to another persistent object.
Property methods: SpouseGet(), SpouseGetObject(), SpouseGetObjectId(), SpouseGetStored(), SpouseGetSwizzled(), SpouseIsValid(), SpouseNewObject(), SpouseSet(), SpouseSetObject(), SpouseSetObjectId(), SpouseUnSwizzle()
Methods
A simple, sample method: add two numbers (x and y)
and return the result.
This class method calculates a current age given a date of birth date.
method NinetyNine() as %Integer
A simple, sample expression method: returns the value 99.
method PrintPerson()
Prints the property Name to the console.
classmethod PrintPersons()
Invoke the PrintPerson() on all Person objects
within the database.
classmethod PrintPersonsSQL()
Prints out data on all persons within the database using SQL to
iterate over all the person data.
classmethod StoredProcTest(name As %String, ByRef response As %String) as %Integer [ SQLProc = Stored_Procedure_Test ]
Projected as the stored procedure: Stored_Procedure_Test
This is a sample of how to define an SQL stored procedure using a
class method. This method can be called as a stored procedure via
ODBC or JDBC.
In this case this method returns the concatenation of a string value.
In this case this method returns the concatenation of a string value.
classmethod UpdateProcTest(zip As %String, city As %String, state As %String) as %Integer [ SQLProc = Person_UpdateProcTest ]
Projected as the stored procedure: Person_UpdateProcTest
This is a sample of how to define an SQL stored procedure using a
class method. This method can be called as a stored procedure via
ODBC or JDBC.
This method performs an SQL update operation on the database using embedded SQL. The update modifies the embedded properties Home.City and Home.State for all rows whose Home.Zip is equal to zip.
This method performs an SQL update operation on the database using embedded SQL. The update modifies the embedded properties Home.City and Home.State for all rows whose Home.Zip is equal to zip.
Queries
query ByName(name As %String = "")
SQL Query:
SELECT ID, Name, DOB, SSN FROM Sample.Person WHERE (Name %STARTSWITH :name) ORDER BY Name
SELECT ID, Name, DOB, SSN FROM Sample.Person WHERE (Name %STARTSWITH :name) ORDER BY Name
A sample class query that defines a result set that returns Person data
ordered by Name.
This query can be used within another Caché method (using the %ResultSet class), from Java, or from ActiveX.
This query is also accessible from ODBC and/or JDBC as the SQL stored procedure SP_Sample_By_Name.
This query can be used within another Caché method (using the %ResultSet class), from Java, or from ActiveX.
This query is also accessible from ODBC and/or JDBC as the SQL stored procedure SP_Sample_By_Name.
Indexes
index ($Person on ) [Extent, Type = bitmap];
index (IDKEY on ) [IdKey, Type = key];
Index methods: IDKEYCheck(), IDKEYDelete(), IDKEYExists(), IDKEYOpen(), IDKEYSQLCheckUnique(), IDKEYSQLExists(), IDKEYSQLFindPKeyByConstraint(), IDKEYSQLFindRowIDByConstraint()
index (NameIDX on Name) [Data = Name];
Define an index for Name.
Index methods: NameIDXExists()
index (SSNKey on SSN) [Unique];
Define a unique index for SSN.
Index methods: SSNKeyCheck(), SSNKeyCheckUnique(), SSNKeyDelete(), SSNKeyExists(), SSNKeyOpen(), SSNKeySQLCheckUnique(), SSNKeySQLExists(), SSNKeySQLFindPKeyByConstraint(), SSNKeySQLFindRowIDByConstraint()
index (ZipCode on Home.Zip) [Type = bitmap];
Define an index for embedded object property ZipCode.
Inherited Members
Inherited Methods
- %AddToSaveSet()
- %AddToSyncSet()
- %BMEBuilt()
- %CheckConstraints()
- %CheckConstraintsForExtent()
- %ClassIsLatestVersion()
- %ClassName()
- %ComposeOid()
- %ConstructClone()
- %Delete()
- %DeleteExtent()
- %DeleteId()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Exists()
- %ExistsId()
- %Extends()
- %GUID()
- %GUIDSet()
- %GetLock()
- %GetParameter()
- %GetSwizzleObject()
- %Id()
- %InsertBatch()
- %IsA()
- %IsModified()
- %IsNull()
- %KillExtent()
- %KillExtentData()
- %LoadFromMemory()
- %LockExtent()
- %LockId()
- %New()
- %NormalizeObject()
- %ObjectIsNull()
- %ObjectModified()
- %Oid()
- %OnBeforeAddToSync()
- %OnDetermineClass()
- %Open()
- %OpenId()
- %OriginalNamespace()
- %PackageName()
- %PhysicalAddress()
- %PurgeIndices()
- %Reload()
- %RemoveFromSaveSet()
- %ResolveConcurrencyConflict()
- %RollBack()
- %Save()
- %SaveDirect()
- %SaveIndices()
- %SerializeObject()
- %SetModified()
- %SortBegin()
- %SortEnd()
- %SyncObjectIn()
- %SyncTransport()
- %UnlockExtent()
- %UnlockId()
- %ValidateIndices()
- %ValidateObject()
- OnPopulate()
- Populate()
- PopulateSerial()
- XMLDTD()
- XMLExport()
- XMLExportToStream()
- XMLExportToString()
- XMLNew()
- XMLSchema()
- XMLSchemaNamespace()
- XMLSchemaType()
Storage
Storage Model: CacheStorage (Sample.Person)
^Sample.PersonD(ID) | = | %%CLASSNAME
Name
SSN
DOB
Home
Office
Spouse
FavoriteColors
|