SQL::IndexInfo Object

A SQL::IndexInfo object (an index description) is a container for one or more SQL::IndexColumnInfo objects (column descriptions for indexes).

Each table in a SQL database has one or more relationships, constraints or indexes. The primary key, foreign keys, and unique and non-unique indexes are each described by a SQL::IndexInfo instance. The SQL::IndexInfo object contains a list of those indexes.

dim conn as SQL::Connection

dim ti as SQL::TableInfo

dim ii as SQL::IndexInfo

dim ic as SQL::IndexColumnInfo

dimm connstring as C

connString = "{A5API='Access', FileName='c:\program files\a5v7\mdbfiles\alphasports.mdb'}"

if .not. conn.open(connString) then

    end

end if

ic.name = "lastname"

ii.AddColumn(ic)

ii.unique = .f.

ti.name = "customer"

conn.CreateIndex(ti, ii)

conn.close()

Properties

The SQL::IndexInfo object has the following properties.

Property

Type

Mode

Description

Column

P

RW

An array of the column definitions ( SQL::IndexColumnInfo ) for the index.

Comment

C

RW

Default = "". The comment stored for the table (if the database supports it).

DeleteRule

N

RW

Default = 0. The options are:

  • 0 = Restrict

  • 1 = Cascade

  • 2 = SetNull

  • 3 = SetDefault

IndexMethod

C

RW

Default = "". The database specific indexing method.

Name

C

RW

Default = "". The unique name of the table. Note: The table must be unique for the owner, but does not need to be globally unique.

PrimaryKey

L

RW

Default = FALSE (.F.). True if the index is the primary key for this table.

Reference

L

RW

Default = FALSE (.F.). True if this is a foreign key.

ReferenceTable

P

RW

Default = "". For foreign keys only. The name of the table the index is assigned to.

ReferenceTableOwner

C

RW

Default = "". For foreign keys only. The owner name of the referenced table.

Unique

L

RW

Default = TRUE (.T.). True if this is a unique index.

UpdateRule

N

RW

Default = 0. The options are:

  • 0 = Restrict

  • 1 = Cascade

  • 2 = SetNull

  • 3 = SetDefault

XML

C

RW

The schema in XML format.

Methods

The SQL::IndexInfo object has the following methods.

Method

Description

::AddColumn()

Adds a new column to the column property.

::Clone()

Makes a copy of the SQL::IndexInfo object and its contents.

::InsertColumn()

Adds a new column to the Column property before the specified column index.

See Also

SQL Objects, Arrays of Objects

Supported By

Alpha Five Version 8 Enterprise Edition

Limitations

Desktop applications only.