Gambas Documentation - /comp/gb.mysql/_index/add

/comp/gb.mysql/_index/add

# _Index.Add (gb.mysql)

Sub Add ( Index As String, Columns As String[] [ , Table As String, Database As String ] )

Creates an index to a table.

Index: Is the mane for the index.
Columns: Is an array containing all the fields names that form the index.
Table: Is the table to use, if none is provided, then the current table is used.

### Examples

    Dim hCon As New Connection

    With hCon
      .Type = "mysql"
      .Port = "3306"
      .Host = "localhost"
      .User = "root"
      .Password = "mypass"
      .Name = "Gambas"
      .Open()
    End With

    hCon.MySQL.Index.Add("idx_actor_id", ["actor_id", "first_name"], "actor")

    MySQL statement: CREATE INDEX `idx_actor_id` ON `actor` (`actor_id`, `first_name`)