comp • gb.mysql • _field • primarykey

_Field.PrimaryKey (gb.mysql)

Sub PrimaryKey ( Fields As String[] )

Stores the information for a primary key, later, that information will be used to create a table.

Fields: Is an array containing all the field names that form the primary key.

When the table is created all the primary key's information is cleaned.

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.Field.PrimaryKey(["city_id"])

Part of the MySQL statement: PRIMARY KEY(`country_id`)


Dim hCon As New Connection

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

hCon.MySQL.Field.PrimaryKey(["Number", "Code"])

Part of the MySQL statement: PRIMARY KEY(`Number`, `Code`)