docs.intersystems.com
Home  /  Application Development: Core Topics  /  Class Definition Reference  /  Method Keywords  /  Language


Class Definition Reference
Language
[Back]  [Next] 
InterSystems: The power behind what matters   
Search:  


Specifies the language used to implement this method.
Usage
To specify the language used to implement the method, use the following syntax:
Method name(formal_spec) As returnclass [ Language = language ] 
{    //implementation }
Where language is one of the following:
Details
This keyword specifies the language used to implement this method.
The values ispl and tsql are only supported for class methods.
If you specify a value of ispl, the body of the method is limited to a single CREATE PROCEDURE statement.
Default
If you omit this keyword, the language specified by the class-level Language keyword is used.
Note:
You cannot specify Language = ispl at the class level; you can only use this value for methods.
Examples
Class User.Person Extends %Persistent
{

Property Name As %String;

Property Gender As %String;

/// An ObjectScript instance method that writes the name and gender of a person
Method Print() As %Status [ Language = objectscript ]
{
   write !, ..Name, " is a ", ..Gender
}

/// A TSQL class method that inserts a row into the Person table
ClassMethod TSQLTest() As %Status [ Language = tsql ]
{
   INSERT INTO Person (Name, Gender) VALUES ('Manon', 'Female')
}

/// An ISPL class method that creates an stored procedure named IsplSp
ClassMethod ISPLTest() As %Status [ Language = ispl ]
{
   CREATE PROCEDURE IsplSp()
      INSERT INTO Person (Name, Gender) VALUES ('Nikolai', 'Male')
   END PROCEDURE
}

}
See Also