Description
Creates a Btree, Cross Reference, or Relational index for a specified column in a table. The type of index you create dictates the calling syntax.
Syntax
equ BTREETYPE$ to 1 Create_Index(BTREETYPE$, tablename, columnname, casemode, createmode)
equ CROSSREFTYPE$ to 2 Create_Index(CROSSREFTYPE$, tablename, columnname, casemode, createmode, delimiterlist, stoplist)
equ RELATIONALTYPE$ to 3 Create_Index(RELATIONALTYPE$, tablename, columnname, casemode, createmode, desttable, destcolumn, sortmode)
Parameters
The Create_Index subroutine has the following parameters; the first five parameters are identical regardless of the type of index you create. Parameters that differ by index type are defined separately in the sections that follow.
| Parameter | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| indextype | The value of this parameter specifies the type of index you create.
| ||||||||
| tablename | The name of the table to index. | ||||||||
| columnname | The name of the column to index. | ||||||||
| casemode | The case sensitivity of the index.
| ||||||||
| createmode | Specifies whether to build the indexes immediately or process them at a later time.
|
See Also
Cross Reference indexes, Relational indexes, Btree indexes
Example
The following examples show how to create indexes, programmatically.
declare subroutine Create_Index
declare function Get_Status
/* Create a Btree index on the column PART_NAME in the table CAR_PARTS.
Values in the index are not converted to uppercase. Indexes are not updated immediately.
The system stored procedure Update_Index can be run at a later time to update the indexes. */
Create_Index("1", "CAR_PARTS", "PART_NAME", "1", "0")
if Get_Status(ErrCodes) then
GoSub ErrorHandling
end
/* Creates a Cross Reference index on the column TYPE_DESC in the CAR_PART_TYPES table.
All values in the index are converted to uppercase. The indexes are built immediately.
Delimiter_list is a space and a value mark.
The default stop_list is used and two additional words are added to the default list: PRICE and DESCRIPTION. */
DelimiterList = "SPACE":@fm:"VM"
StopList = "2":@fm:"PRICE":@vm:"DESCRIPTION"
Create_Index("2", "CAR_PART_TYPES", "TYPE_DESC", "0", "1",|
DelimiterList, StopList)
/* Creates a Relational index between the CAR_PARTS table and the ORDER_INFO table.
Information in the indexes is converted to uppercase.
The index is built immediately. The sort mode for the index is TOP. */
Create_Index("3", "CAR_PARTS", "ORDER_PLACE", "0", "1",| "ORDER_INFO", "PARTS", "1")
1 Comment
Don Bakke
See also Delete_Index.