gambas-source-code/app/examples/Database/MySQLExample/.src/CreateObjects/FNewTable.class
Benoît Minisini c6a9cd69c2 [EXAMPLES]
* NEW: Add examples again. I hope correctly this time.


git-svn-id: svn://localhost/gambas/trunk@6726 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2014-12-12 19:58:52 +00:00

55 lines
1.2 KiB
Text

' Gambas class file
Private $sTable As String
Private $bEdit As Boolean = False
Public Sub _new(Optional Table As String)
If Table Then
$sTable = Table
$bEdit = True
Endif
txtName.Text = $sTable
End
Public Sub Form_Open()
cmbEngine.List = modMain.$Connection.MySQL.Engines
cmbCharset.List = modMain.$Connection.MySQL.Charsets
If $bEdit Then
Me.Text = ("Edit Table")
lblTitle.Text = Me.Text
txtName.Enabled = False
cmbEngine.Index = cmbEngine.Find(modMain.$Connection.MySQL.Table.Engine($sTable))
cmbCharset.Index = cmbCharset.Find(modMain.$Connection.MySQL.Table.Charset($sTable))
Else
cmbEngine.Index = cmbEngine.Find("InnoDB")
cmbCharset.Index = cmbCharset.Find("utf8")
Endif
Catch
modMain.Error()
End
Public Sub btnCancel_Click()
Me.Close()
End
Public Sub tbnOK_Click()
If $bEdit Then
modMain.$Connection.MySQL.Table.Modify($sTable,, cmbEngine.Text, cmbCharset.Text)
Else
modMain.$Connection.MySQL.Field.Add("Field01", modMain.$Connection.MySQL.DataTypes.Serial)
modMain.$Connection.MySQL.Table.Add(txtName.Text, cmbEngine.Text, cmbCharset.Text)
Endif
modMain.$hFBrowser.LoadDatabases()
modMain.$hFTables.SearchInfo()
Me.Close()
Catch
modMain.Error()
End