Description
Retrieves contract block information for a specified stored procedure.
Syntax
contractblock = Get_Contract (procname, prepost, clause, commentflag, textflag)
Parameters
The Get_Contract function has the following parameters.
Parameter | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
procname | Specifies the name of the stored procedure. | ||||||||
prepost | Indicates which part of the contract block is returned. If null, the default is 0.
| ||||||||
clause | If you want to return a specific clause in the contract, indicate the clause number. A 1 indicates the first clause, a 2 indicates the second clause, etc. If no number is specified, all contract clauses are returned. If clause is less than zero, all contract clauses are returned. | ||||||||
commentflag | If True (1), the comments are not returned with the contract information. By default, the comments are returned. | ||||||||
textflag | If True (1), convert normal system delimiters (@FM, @VM, @SVM) to carriage return/linefeed characters, in the returned data. |
If arguments passed to or returned from a stored procedure fail the contract clause conditions, an error is returned. The error contains the number of the contract clause that failed. You can pass the returned clause number to Get_Contract for additional information about the error.
The contract information is returned in an @FM-delimited array. If both pre: condition and post: condition information is returned, pre: condition information is in field 1 and post: condition information is in field 2. If only pre: condition or post: condition is returned, only one field is returned.
If multiple pre-conditions or post-conditions exist, they are returned as values in either field 1 or in field 2. Comments are returned as subvalues for each condition.
If textflag is True (1), the pre: and post: condition information is separated by the literal "post".
See also
The "Contract Block" topic in Chapter 2: BASIC+ Language Reference.
Example
/* Returns the Pre: and Post: conditions and comments from the contract block for the QUICK_REPORT stored procedure. */ ContractBlock = Get_Contract("QUICK_REPORT", "0") If Get_Status(ErrCodes) Then GoSub ErrorHandling End