[DEVELOPMENT ENVIRONMENT]
* NEW: Database connection: Now you can initialize a new database from the template of another connection of the project. git-svn-id: svn://localhost/gambas/trunk@7850 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
59cd9c2d4a
commit
60dff96936
Binary file not shown.
@ -222,7 +222,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: gambas3 3.8.90\n"
|
||||
"PO-Revision-Date: 2016-08-17 20:15 UTC\n"
|
||||
"PO-Revision-Date: 2016-08-19 15:52 UTC\n"
|
||||
"Last-Translator: Benoît Minisini <gambas@users.sourceforge.net>\n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -1245,7 +1245,7 @@ msgstr "Fermer"
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
#: FDebugInfo.class:76 FNewConnection.form:82 FNewTable.form:48 FProxy.form:27
|
||||
#: FDebugInfo.class:76 FNewConnection.form:85 FNewTable.form:48 FProxy.form:27
|
||||
msgid "Type"
|
||||
msgstr "Type"
|
||||
|
||||
@ -1533,7 +1533,7 @@ msgstr "Ne pas joindre le projet au mail"
|
||||
msgid "(No parent)"
|
||||
msgstr "(Aucune)"
|
||||
|
||||
#: FCreateFile.class:289
|
||||
#: FCreateFile.class:293
|
||||
msgid "Cannot add file."
|
||||
msgstr "Impossible d'ajouter le fichier."
|
||||
|
||||
@ -2081,7 +2081,7 @@ msgstr "Utilisateur"
|
||||
msgid "Password"
|
||||
msgstr "Mot de passe"
|
||||
|
||||
#: FFarmLogin.form:95 FNewConnection.form:174 FProjectVersion.form:155
|
||||
#: FFarmLogin.form:95 FNewConnection.form:177 FProjectVersion.form:155
|
||||
msgid "Remember password"
|
||||
msgstr "Se souvenir du mot de passe"
|
||||
|
||||
@ -3853,47 +3853,51 @@ msgstr "Propriétés de la connexion"
|
||||
msgid "Select a directory"
|
||||
msgstr "Choisissez un répertoire"
|
||||
|
||||
#: FNewConnection.class:212
|
||||
#: FNewConnection.class:215
|
||||
msgid "Create database"
|
||||
msgstr "Créer la base de données"
|
||||
|
||||
#: FNewConnection.class:216
|
||||
#: FNewConnection.class:227
|
||||
msgid "Delete database"
|
||||
msgstr "Supprimer la base de données"
|
||||
|
||||
#: FNewConnection.class:340
|
||||
#: FNewConnection.class:369
|
||||
msgid "Unable to create database."
|
||||
msgstr "Impossible de créer la base de données."
|
||||
|
||||
#: FNewConnection.class:349
|
||||
#: FNewConnection.class:378
|
||||
msgid "Do you really want to delete the database '&1'?"
|
||||
msgstr "Voulez-vous vraiment supprimer la base de données « &1 » ?"
|
||||
|
||||
#: FNewConnection.class:360
|
||||
#: FNewConnection.class:389
|
||||
msgid "Unable to delete database."
|
||||
msgstr "Impossible de supprimer la base de données."
|
||||
|
||||
#: FNewConnection.form:97 FProxy.form:32
|
||||
#: FNewConnection.form:100 FProxy.form:32
|
||||
msgid "Host"
|
||||
msgstr "Hôte"
|
||||
|
||||
#: FNewConnection.form:122
|
||||
#: FNewConnection.form:125
|
||||
msgid "Path"
|
||||
msgstr "Emplacement"
|
||||
|
||||
#: FNewConnection.form:189 Project.module:227
|
||||
#: FNewConnection.form:192 Project.module:227
|
||||
msgid "Database"
|
||||
msgstr "Bases de données"
|
||||
|
||||
#: FNewConnection.form:246
|
||||
#: FNewConnection.form:244
|
||||
msgid "From"
|
||||
msgstr "À partir de"
|
||||
|
||||
#: FNewConnection.form:268
|
||||
msgid "Ignore database charset"
|
||||
msgstr "Ignorer le jeu de caractères de la base de données"
|
||||
|
||||
#: FNewConnection.form:260
|
||||
#: FNewConnection.form:282
|
||||
msgid "Display metadata"
|
||||
msgstr "Afficher les métadonnées"
|
||||
|
||||
#: FNewConnection.form:274
|
||||
#: FNewConnection.form:296
|
||||
msgid "Remember database structure"
|
||||
msgstr "Mémoriser la structure de la base de données"
|
||||
|
||||
@ -5741,7 +5745,7 @@ msgstr "Impossible d'enregistrer le mot de passe."
|
||||
msgid "Cannot create table '&1'."
|
||||
msgstr "Impossible de créer la table « &1 »."
|
||||
|
||||
#: MConnection.module:475
|
||||
#: MConnection.module:493
|
||||
msgid "Cannot create metadata table."
|
||||
msgstr "Impossible de créer la table des métadonnées."
|
||||
|
||||
|
@ -206,20 +206,38 @@ Private Sub UpdateCreateDatabase()
|
||||
Dim sDatabase As String
|
||||
|
||||
If Not $hConn.Opened Then Return
|
||||
|
||||
sDatabase = Trim(txtDatabase.Text)
|
||||
If sDatabase Then
|
||||
|
||||
If Not $hConn.Databases.Exist(sDatabase) Then
|
||||
|
||||
btnCreateDatabase.Text = ("Create database")
|
||||
|
||||
btnCreateDatabase.Show
|
||||
btnDeleteDatabase.Hide
|
||||
|
||||
cmbCreateFrom.List = MConnection.GetTemplates()
|
||||
panCreateFrom.Visible = cmbCreateFrom.Count
|
||||
chkCreateFrom.Value = False
|
||||
cmbCreateFrom.Enabled = False
|
||||
|
||||
Else
|
||||
|
||||
btnDeleteDatabase.Text = ("Delete database")
|
||||
|
||||
btnCreateDatabase.Hide
|
||||
panCreateFrom.Hide
|
||||
btnDeleteDatabase.Show
|
||||
|
||||
Endif
|
||||
|
||||
panDatabaseAction.Show
|
||||
|
||||
Else
|
||||
|
||||
panDatabaseAction.Hide
|
||||
|
||||
Endif
|
||||
|
||||
Try lvwDatabase[sDatabase].Selected = True
|
||||
@ -329,9 +347,20 @@ End
|
||||
|
||||
Public Sub btnCreateDatabase_Click()
|
||||
|
||||
Dim hConn As Connection
|
||||
Dim sName As String
|
||||
|
||||
Inc Application.Busy
|
||||
$hConn.Databases.Add(Trim(txtDatabase.Text))
|
||||
sName = Trim(txtDatabase.Text)
|
||||
$hConn.Databases.Add(sName)
|
||||
FillDatabaseList
|
||||
If chkCreateFrom.Value Then
|
||||
hConn = $hConn.Copy()
|
||||
hConn.Name = sName
|
||||
hConn.Open
|
||||
hConn.ApplyTemplate(File.Load(Project.Dir &/ ".connection" &/ cmbCreateFrom.Text & ".template"))
|
||||
hConn.Close
|
||||
Endif
|
||||
Dec Application.Busy
|
||||
|
||||
Catch
|
||||
@ -361,3 +390,9 @@ Catch
|
||||
txtDatabase.SetFocus
|
||||
|
||||
End
|
||||
|
||||
Public Sub chkCreateFrom_Click()
|
||||
|
||||
cmbCreateFrom.Enabled = chkCreateFrom.Value
|
||||
|
||||
End
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,98,91)
|
||||
MoveScaled(0,0,103,91)
|
||||
Icon = Picture["img/16/database.png"]
|
||||
Resizable = False
|
||||
Arrangement = Arrange.Vertical
|
||||
@ -65,7 +65,7 @@
|
||||
}
|
||||
}
|
||||
{ panLogin VBox
|
||||
MoveScaled(1,21,68,13)
|
||||
MoveScaled(1,21,96,9)
|
||||
Spacing = True
|
||||
{ HBox4 HBox
|
||||
MoveScaled(0,0,68,4)
|
||||
@ -79,9 +79,10 @@
|
||||
}
|
||||
}
|
||||
{ HBox5 HBox
|
||||
MoveScaled(0,5,68,4)
|
||||
MoveScaled(0,5,79,4)
|
||||
Spacing = True
|
||||
{ Label4 Label
|
||||
MoveScaled(0,0,18,4)
|
||||
MoveScaled(0,0,17,4)
|
||||
Text = ("Password")
|
||||
}
|
||||
{ txtPassword TextBox
|
||||
@ -89,25 +90,20 @@
|
||||
Expand = True
|
||||
Password = True
|
||||
}
|
||||
}
|
||||
{ HBox9 HBox
|
||||
MoveScaled(0,10,68,3)
|
||||
{ Label9 Label
|
||||
MoveScaled(0,0,18,3)
|
||||
}
|
||||
{ chkRememberPassword CheckBox
|
||||
MoveScaled(27,0,24,3)
|
||||
MoveScaled(53,0,24,4)
|
||||
Expand = True
|
||||
AutoResize = True
|
||||
Text = ("Remember password")
|
||||
}
|
||||
}
|
||||
}
|
||||
{ panDatabase VBox
|
||||
MoveScaled(1,35,84,47)
|
||||
MoveScaled(1,35,96,47)
|
||||
AutoResize = True
|
||||
Spacing = True
|
||||
{ HBox6 HBox
|
||||
MoveScaled(0,0,84,4)
|
||||
MoveScaled(0,0,96,4)
|
||||
{ Label6 Label
|
||||
MoveScaled(0,0,18,4)
|
||||
Text = ("Database")
|
||||
@ -119,13 +115,13 @@
|
||||
}
|
||||
}
|
||||
{ panChooseDatabase HBox
|
||||
MoveScaled(0,5,68,30)
|
||||
MoveScaled(0,5,95,30)
|
||||
Visible = False
|
||||
{ Label8 Label
|
||||
MoveScaled(0,0,18,3)
|
||||
}
|
||||
{ VBox1 VBox
|
||||
MoveScaled(32,0,35,18)
|
||||
MoveScaled(27,0,66,18)
|
||||
Expand = True
|
||||
Spacing = True
|
||||
{ lvwDatabase ListView
|
||||
@ -133,7 +129,7 @@
|
||||
Expand = True
|
||||
}
|
||||
{ panDatabaseAction HBox
|
||||
MoveScaled(0,12,34,4)
|
||||
MoveScaled(0,12,65,4)
|
||||
Spacing = True
|
||||
{ btnCreateDatabase Button
|
||||
MoveScaled(0,0,14,4)
|
||||
@ -145,6 +141,22 @@
|
||||
AutoResize = True
|
||||
Picture = Picture["icon:/small/delete"]
|
||||
}
|
||||
{ panCreateFrom HBox
|
||||
MoveScaled(30,0,30,4)
|
||||
Expand = True
|
||||
Spacing = True
|
||||
{ chkCreateFrom CheckBox
|
||||
MoveScaled(0,0,9,4)
|
||||
AutoResize = True
|
||||
Text = ("From")
|
||||
}
|
||||
{ cmbCreateFrom ComboBox
|
||||
MoveScaled(9,0,20,4)
|
||||
Enabled = False
|
||||
Expand = True
|
||||
ReadOnly = True
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -334,6 +334,24 @@ Finally
|
||||
|
||||
End
|
||||
|
||||
Public Sub GetTemplates() As String[]
|
||||
|
||||
Dim sFile As String
|
||||
Dim aConn As New String[]
|
||||
|
||||
For Each sFile In Dir(Project.Dir &/ ".connection", "*.template")
|
||||
sFile = File.BaseName(sFile)
|
||||
If Not Exist(Project.Dir &/ ".connection" &/ sFile & ".connection") Then Continue
|
||||
aConn.Add(sFile)
|
||||
Next
|
||||
aConn.Sort
|
||||
|
||||
Finally
|
||||
|
||||
Return aConn
|
||||
|
||||
End
|
||||
|
||||
Public Sub FillViewWithTables(lvwTable As TreeView, hConn As Connection, bShowSystem As Boolean)
|
||||
|
||||
Dim hTable As Table
|
||||
|
@ -19,10 +19,10 @@ SearchString=True
|
||||
|
||||
[OpenFile]
|
||||
File[1]=".src/Main.module:0.16"
|
||||
Active=2
|
||||
Active=3
|
||||
File[2]=".src/Connections.class:41.180"
|
||||
Count=4
|
||||
File[3]=".src/Connection.class:2.133"
|
||||
File[3]=".src/Connection.class:0.233"
|
||||
File[4]=".src/SQLRequest.class:2.57"
|
||||
|
||||
[Watches]
|
||||
|
@ -226,6 +226,26 @@ Public Sub GetTemplate() As String
|
||||
|
||||
End
|
||||
|
||||
Public Sub Copy() As Connection
|
||||
|
||||
Dim hConn As Connection
|
||||
|
||||
hConn = New Connection
|
||||
hConn.Host = Me.Host
|
||||
hConn.IgnoreCharset = Me.IgnoreCharset
|
||||
hConn.Name = Me.Name
|
||||
hConn.Password = Me.Password
|
||||
hConn.Port = Me.Port
|
||||
hConn.Timeout = Me.Timeout
|
||||
hConn.Type = Me.Type
|
||||
hConn.User = Me.User
|
||||
|
||||
Return hConn
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
||||
Private Function SQL_Read() As SQLRequest
|
||||
|
||||
Return New SQLRequest(Me)
|
||||
|
Loading…
x
Reference in New Issue
Block a user