Xbasic
SQL::IndexInfoInsertColumn Method
Syntax
Result_Flag as L = InsertColumn(Column as SQL::IndexColumnInfo [, InsertBefore as N = 1])
Arguments
- Result_Flag
Indicates whether the operation was successful.
- Column
A SQL::IndexColumnInfo object and having (at a minimum) a value for the .name property.
- InsertBefore
Optional. The index of the column before which the new column should be inserted.
Description
Insert a new Column.
Discussion
The SQL::IndexInfo.InsertColumn() method adds a new column definition to a <SQL::IndexInfo> index definition.
Example
dim IndexInfo as SQL::IndexInfo
dim IndexColumn as SQL::IndexColumnInfo
IndexInfo.Name = "Primary_Key"
IndexInfo.PrimaryKey = .t.
IndexColumn.Name = "MyColumnName"
if .not. IndexInfo.AddColumn(IndexColumn) then
ui_msg_box("Error", "Could not add index")
end if
IndexInfo.Name = "Lastname"
IndexInfo.PrimaryKey = .f.
IndexColumn.Name = "Lastname"
if .not. IndexInfo.InsertColumn(IndexColumn, 1) then
ui_msg_box("Error", "Could not insert index")
end if
ui_msg_box("Index Column Definition", IndexInfo.XML)See Also