comp • gb.mysql • _field • add

_Field.Add (gb.mysql)

Sub Add ( Field As String, DataType As String [ , AceptNull? As Boolean, DefaultValue As Variant, AutoIncrement? As Boolean, OnUpdate As String, Comment As String ] )

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

When the table is created all the field's information is cleaned.


Dim hCon As New Connection

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

hCon.MySQL.Field.Add("actor_id", hCon.MySQL.DataTypes.UnsignedSmallInt, False,, True)

Part of the MySQL statement: `actor_id` smallint(5) unsigned NOT NULL auto_increment,

Dim hCon As New Connection

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

hCon.MySQL.Field.Add("last_update", hCon.MySQL.DataTypes.TimeStamp, False, "CURRENT_TIMESTAMP",, "CURRENT_TIMESTAMP")

Part of the MySQL statement: `last_update` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,