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

/comp/gb.mysql/_view/add

# _View.Add (gb.mysql)

Sub Add ( View As String, Statement As String [ , Replace As Boolean ] )

Creates a view in the current database.

View: Is the view name.
Statement: Is the query to create the view.
Replace: Accepts True or False, if True is given, then if the view already exists it will be replaced.

### 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.View.Add("view_actor", "SELECT * FROM actor", True)

    MySQL statement: CREATE OR REPLACE VIEW `view_actor` AS SELECT * FROM actor