Database.IndexSchema

From Xojo Documentation

Method

Database.IndexSchema(TableName as String) As RecordSet

New in 2005r1

Supported for all project types and targets.

Returns a RecordSet containing the list of indexes for the passed TableName. Returns Nil if the table has no indexes or the database source does not support indexes.

Notes

The RecordSet returns one row for each index on the table and it has one field: IndexName As String.

The RecordSet result has a single column:

  • IndexName: A string containing the name of the index.

Sample Code

This code displays the indexes for the "Invoices" table (if it exists) in the specified SQLite database:

Dim dbFile As FolderItem
dbFile = GetOpenFolderItem("")

If dbFile <> Nil Then
Dim db As New SQLiteDatabase
If db.Connect Then
Dim indexRS As RecordSet
indexRS = db.IndexSchema("Invoices") // A table with indexes in the SQLite DB
If indexRS <> Nil Then
While Not indexRS.EOF
MsgBox("Index: " + indexRS.IdxField(1).StringValue)
indexRS.MoveNext
Wend
indexRS.Close
End If
End If
End If