Difference between revisions of "Database.IndexSchema"

From Xojo Documentation

Line 1: Line 1:
| name=IndexSchema
| name=IndexSchema

Revision as of 21:25, 20 May 2019


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.


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)
End If
End If
End If