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

/comp/gb.mysql/_database/add

# _DataBase.Add (gb.mysql)

Sub Add ( Database As String [ , Charset As String, Collation As String ] )

Creates a database

Database: Is the database name.
Charset: Is the charset to use.
Collation: Is the collation to use.

If Charset and Collation are not provided, then the default ones are 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.DataBase.Add("Gambas", hCon.MySQL.Charset, hCon.MySQL.Collation)

    MySQL statement: CREATE DATABASE `Gambas` DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE utf8_general_ci