diff --git a/Controls.SQLEditor/My Project/Resources.Designer.vb b/Controls.SQLEditor/My Project/Resources.Designer.vb
index bd814192..7c8f1584 100644
--- a/Controls.SQLEditor/My Project/Resources.Designer.vb
+++ b/Controls.SQLEditor/My Project/Resources.Designer.vb
@@ -100,6 +100,26 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
+ '''
+ Friend ReadOnly Property actions_database2() As DevExpress.Utils.Svg.SvgImage
+ Get
+ Dim obj As Object = ResourceManager.GetObject("actions_database2", resourceCulture)
+ Return CType(obj,DevExpress.Utils.Svg.SvgImage)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
+ '''
+ Friend ReadOnly Property actions_user() As DevExpress.Utils.Svg.SvgImage
+ Get
+ Dim obj As Object = ResourceManager.GetObject("actions_user", resourceCulture)
+ Return CType(obj,DevExpress.Utils.Svg.SvgImage)
+ End Get
+ End Property
+
'''
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
'''
@@ -110,6 +130,26 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
+ '''
+ Friend ReadOnly Property clearall() As DevExpress.Utils.Svg.SvgImage
+ Get
+ Dim obj As Object = ResourceManager.GetObject("clearall", resourceCulture)
+ Return CType(obj,DevExpress.Utils.Svg.SvgImage)
+ End Get
+ End Property
+
+ '''
+ ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
+ '''
+ Friend ReadOnly Property cleartablestyle() As DevExpress.Utils.Svg.SvgImage
+ Get
+ Dim obj As Object = ResourceManager.GetObject("cleartablestyle", resourceCulture)
+ Return CType(obj,DevExpress.Utils.Svg.SvgImage)
+ End Get
+ End Property
+
'''
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
'''
@@ -130,6 +170,16 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
+ '''
+ Friend ReadOnly Property electronics_desktopmac() As DevExpress.Utils.Svg.SvgImage
+ Get
+ Dim obj As Object = ResourceManager.GetObject("electronics_desktopmac", resourceCulture)
+ Return CType(obj,DevExpress.Utils.Svg.SvgImage)
+ End Get
+ End Property
+
'''
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
'''
@@ -140,6 +190,16 @@ Namespace My.Resources
End Get
End Property
+ '''
+ ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
+ '''
+ Friend ReadOnly Property removegroupheader() As DevExpress.Utils.Svg.SvgImage
+ Get
+ Dim obj As Object = ResourceManager.GetObject("removegroupheader", resourceCulture)
+ Return CType(obj,DevExpress.Utils.Svg.SvgImage)
+ End Get
+ End Property
+
'''
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
'''
diff --git a/Controls.SQLEditor/My Project/Resources.resx b/Controls.SQLEditor/My Project/Resources.resx
index 2e2bfdf3..f30ca6ae 100644
--- a/Controls.SQLEditor/My Project/Resources.resx
+++ b/Controls.SQLEditor/My Project/Resources.resx
@@ -118,40 +118,58 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- ..\Resources\actions_database.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+ ..\Resources\updatedataextract2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-
- ..\Resources\updatedataextract1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+ ..\Resources\removegroupheader.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-
- ..\Resources\actions_check.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-
-
- ..\Resources\actions_database1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-
-
- ..\Resources\updatedataextract3.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+ ..\Resources\actions_user.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
..\Resources\editdatasource.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-
- ..\Resources\updatedataextract2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-
-
- ..\Resources\updatedataextract.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-
-
- ..\Resources\highimportance.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-
-
- ..\Resources\actions_checkcircled.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+ ..\Resources\actions_check.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
..\Resources\check.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+ ..\Resources\highimportance.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+
+ ..\Resources\actions_database.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+
+ ..\Resources\electronics_desktopmac.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+
+ ..\Resources\clearall.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+
+ ..\Resources\actions_database2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+
+ ..\Resources\updatedataextract1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+
+ ..\Resources\updatedataextract3.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+
+ ..\Resources\actions_checkcircled.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
..\Resources\editdatasource1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+ ..\Resources\updatedataextract.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+
+ ..\Resources\actions_database1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
+
+ ..\Resources\cleartablestyle.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+
\ No newline at end of file
diff --git a/Controls.SQLEditor/Placeholder.vb b/Controls.SQLEditor/Placeholder.vb
new file mode 100644
index 00000000..1588548f
--- /dev/null
+++ b/Controls.SQLEditor/Placeholder.vb
@@ -0,0 +1,45 @@
+Imports DigitalData.Modules.Patterns
+
+Public Class Placeholder
+ '''
+ ''' The internal Category of the placeholder, ie. the INT Part of {#INT#USERNAME}
+ '''
+ Public Property [Module] As String
+
+ '''
+ ''' The internal Name of the placeholder, ie. the USERNAME Part of {#INT#USERNAME}
+ '''
+ Public Property Name As String
+
+ '''
+ ''' The Value that this palceholder is replaced by, user entry.
+ '''
+ '''
+ Public Property Value As String
+
+ '''
+ ''' The internal pattern object
+ '''
+ '''
+ Public Property Pattern As Pattern
+
+ Public Title As String
+ Public Description As String
+
+ Public Enum PlaceholderType
+ FileFlow
+ End Enum
+
+ Public Sub New(pTitle As String, pDescription As String, pModule As String, pName As String)
+ Title = pTitle
+ Description = pDescription
+
+ Name = pName
+ [Module] = pModule
+ End Sub
+
+ Public Overrides Function Equals(obj As Object) As Boolean
+ Return DirectCast(obj, Placeholder).Module = [Module] And
+ DirectCast(obj, Placeholder).Name = Name
+ End Function
+End Class
\ No newline at end of file
diff --git a/Controls.SQLEditor/Placeholders.vb b/Controls.SQLEditor/Placeholders.vb
new file mode 100644
index 00000000..6a08e747
--- /dev/null
+++ b/Controls.SQLEditor/Placeholders.vb
@@ -0,0 +1,54 @@
+Imports DevExpress.Utils.Svg
+Imports DevExpress.XtraBars.Ribbon
+
+Public Class Placeholders
+ Public Function GetInternalGroup() As GalleryItemGroup
+ Dim oModule = "INT"
+ Dim oImage = My.Resources.electronics_desktopmac
+
+ Dim oItems As New List(Of GalleryItem)() From {
+ GetGalleryItem(New Placeholder("USERNAME", "Benutzername", oModule, "USERNAME"), oImage),
+ GetGalleryItem(New Placeholder("MACHINE", "Aktuelles Datum", oModule, "MACHINE"), oImage),
+ GetGalleryItem(New Placeholder("DOMAIN", "Email-Adresse", oModule, "DOMAIN"), oImage),
+ GetGalleryItem(New Placeholder("DATE", "Vorname", oModule, "DATE"), oImage)
+ }
+ Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Intern"}
+
+ oGroup1.Items.AddRange(oItems.ToArray)
+ Return oGroup1
+ End Function
+
+ Public Function GetUserGroup() As GalleryItemGroup
+ Dim oModule = "USER"
+ Dim oImage = My.Resources.actions_user
+
+ Dim oItems As New List(Of GalleryItem)() From {
+ GetGalleryItem(New Placeholder("PRENAME", "Vorname", oModule, "PRENAME"), oImage),
+ GetGalleryItem(New Placeholder("SURNAME", "Nachname", oModule, "SURNAME"), oImage),
+ GetGalleryItem(New Placeholder("EMAIL", "Email-Adresse", oModule, "EMAIL"), oImage),
+ GetGalleryItem(New Placeholder("USER_ID", "Benutzer-ID", oModule, "USER_ID"), oImage),
+ GetGalleryItem(New Placeholder("PROFILE_ID", "Profil-ID", oModule, "PROFILE_ID"), oImage),
+ GetGalleryItem(New Placeholder("PROFILE_TITLE", "Profil-Name", oModule, "PROFILE_TITLE"), oImage),
+ GetGalleryItem(New Placeholder("LANGUAGE", "Sprache", oModule, "LANGUAGE"), oImage)
+ }
+ Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Benutzer"}
+
+ oGroup1.Items.AddRange(oItems.ToArray)
+ Return oGroup1
+ End Function
+
+ Private Function GetGalleryItem(pPlaceholder As Placeholder) As GalleryItem
+ Return New GalleryItem(Nothing, pPlaceholder.Title, pPlaceholder.Description) With {
+ .Tag = pPlaceholder
+ }
+ End Function
+
+ Private Function GetGalleryItem(pPlaceholder As Placeholder, pImage As SvgImage) As GalleryItem
+ Dim oItem = New GalleryItem(Nothing, pPlaceholder.Title, pPlaceholder.Description) With {
+ .Tag = pPlaceholder
+ }
+ oItem.ImageOptions.SvgImage = pImage
+
+ Return oItem
+ End Function
+End Class
diff --git a/Controls.SQLEditor/Resources/actions_database2.svg b/Controls.SQLEditor/Resources/actions_database2.svg
new file mode 100644
index 00000000..af7a23c1
--- /dev/null
+++ b/Controls.SQLEditor/Resources/actions_database2.svg
@@ -0,0 +1,17 @@
+
+
\ No newline at end of file
diff --git a/Controls.SQLEditor/Resources/actions_user.svg b/Controls.SQLEditor/Resources/actions_user.svg
new file mode 100644
index 00000000..8c183040
--- /dev/null
+++ b/Controls.SQLEditor/Resources/actions_user.svg
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/Controls.SQLEditor/Resources/clearall.svg b/Controls.SQLEditor/Resources/clearall.svg
new file mode 100644
index 00000000..0ebb0456
--- /dev/null
+++ b/Controls.SQLEditor/Resources/clearall.svg
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/Controls.SQLEditor/Resources/cleartablestyle.svg b/Controls.SQLEditor/Resources/cleartablestyle.svg
new file mode 100644
index 00000000..f5becce1
--- /dev/null
+++ b/Controls.SQLEditor/Resources/cleartablestyle.svg
@@ -0,0 +1,14 @@
+
+
\ No newline at end of file
diff --git a/Controls.SQLEditor/Resources/electronics_desktopmac.svg b/Controls.SQLEditor/Resources/electronics_desktopmac.svg
new file mode 100644
index 00000000..919cfe4d
--- /dev/null
+++ b/Controls.SQLEditor/Resources/electronics_desktopmac.svg
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/Controls.SQLEditor/Resources/removegroupheader.svg b/Controls.SQLEditor/Resources/removegroupheader.svg
new file mode 100644
index 00000000..beb2c741
--- /dev/null
+++ b/Controls.SQLEditor/Resources/removegroupheader.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/Controls.SQLEditor/SQLEditor.vbproj b/Controls.SQLEditor/SQLEditor.vbproj
index 1037b070..a66ced1a 100644
--- a/Controls.SQLEditor/SQLEditor.vbproj
+++ b/Controls.SQLEditor/SQLEditor.vbproj
@@ -138,6 +138,8 @@
Settings.settings
True
+
+
@@ -229,5 +231,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Controls.SQLEditor/SQLSyntaxHighlightService.vb b/Controls.SQLEditor/SQLSyntaxHighlightService.vb
index 69a68ca1..d4cc1ea8 100644
--- a/Controls.SQLEditor/SQLSyntaxHighlightService.vb
+++ b/Controls.SQLEditor/SQLSyntaxHighlightService.vb
@@ -15,8 +15,9 @@ Public Class SQLSyntaxHighlightService
Private _keywords As Regex
Private _quotedString As New Regex("'([^']|'')*'")
Private _commentedString As New Regex("(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)")
+ Private _placeholderString As New Regex("{#(\w+)#([\:\.\w\s_/-]+)}")
- Private keywords As New List(Of String) From {
+ Private ReadOnly keywords As New List(Of String) From {
"INSERT",
"SELECT",
"CREATE",
@@ -72,6 +73,14 @@ Public Class SQLSyntaxHighlightService
End If
Next j
+ 'Find all placeholders
+ ranges = TryCast(document.FindAll(_placeholderString).GetAsFrozen(), DocumentRange())
+ For j As Integer = 0 To ranges.Length - 1
+ If Not IsRangeInTokens(ranges(j), tokens) Then
+ tokens.Add(CreateToken(ranges(j).Start.ToInt(), ranges(j).End.ToInt(), Color.DarkTurquoise))
+ End If
+ Next j
+
'Find all comments
ranges = TryCast(document.FindAll(_commentedString).GetAsFrozen(), DocumentRange())
For j As Integer = 0 To ranges.Length - 1
diff --git a/Controls.SQLEditor/frmSQLEditor.Designer.vb b/Controls.SQLEditor/frmSQLEditor.Designer.vb
index 1ef40631..428abeb2 100644
--- a/Controls.SQLEditor/frmSQLEditor.Designer.vb
+++ b/Controls.SQLEditor/frmSQLEditor.Designer.vb
@@ -29,16 +29,19 @@ Partial Class frmSQLEditor
Me.btnEditConnections = New DevExpress.XtraBars.BarButtonItem()
Me.btnSave = New DevExpress.XtraBars.BarButtonItem()
Me.btnExecuteSQL = New DevExpress.XtraBars.BarButtonItem()
+ Me.RibbonGalleryBarItem2 = New DevExpress.XtraBars.RibbonGalleryBarItem()
+ Me.chkClearPlaceholders = New DevExpress.XtraBars.BarCheckItem()
+ Me.btnClearPlaceholders = New DevExpress.XtraBars.BarButtonItem()
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
- Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
- Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup3 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
+ Me.RibbonPageGroup4 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
+ Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RichEditControl1 = New DevExpress.XtraRichEdit.RichEditControl()
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
- Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
- Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
+ Me.GridPlaceholders = New DevExpress.XtraGrid.GridControl()
+ Me.ViewPlaceholders = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.colPattern = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colValue = New DevExpress.XtraGrid.Columns.GridColumn()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -49,16 +52,16 @@ Partial Class frmSQLEditor
CType(Me.SplitContainerControl1.Panel2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerControl1.Panel2.SuspendLayout()
Me.SplitContainerControl1.SuspendLayout()
- CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit()
- CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.GridPlaceholders, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.ViewPlaceholders, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'RibbonControl1
'
Me.RibbonControl1.ExpandCollapseItem.Id = 0
- Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.RibbonGalleryBarItem1, Me.btnEditConnections, Me.btnSave, Me.btnExecuteSQL})
+ Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.RibbonGalleryBarItem1, Me.btnEditConnections, Me.btnSave, Me.btnExecuteSQL, Me.RibbonGalleryBarItem2, Me.chkClearPlaceholders, Me.btnClearPlaceholders})
Me.RibbonControl1.Location = New System.Drawing.Point(0, 0)
- Me.RibbonControl1.MaxItemId = 5
+ Me.RibbonControl1.MaxItemId = 11
Me.RibbonControl1.Name = "RibbonControl1"
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
Me.RibbonControl1.Size = New System.Drawing.Size(1056, 158)
@@ -72,7 +75,6 @@ Partial Class frmSQLEditor
'
Me.RibbonGalleryBarItem1.Gallery.Images = Me.SvgImageCollection1
Me.RibbonGalleryBarItem1.Gallery.ShowGroupCaption = True
- Me.RibbonGalleryBarItem1.Gallery.ShowItemImage = False
Me.RibbonGalleryBarItem1.Gallery.ShowItemText = True
Me.RibbonGalleryBarItem1.Id = 1
Me.RibbonGalleryBarItem1.Name = "RibbonGalleryBarItem1"
@@ -102,26 +104,38 @@ Partial Class frmSQLEditor
Me.btnExecuteSQL.ImageOptions.SvgImage = Global.DigitalData.Controls.SQLEditor.My.Resources.Resources.updatedataextract3
Me.btnExecuteSQL.Name = "btnExecuteSQL"
'
+ 'RibbonGalleryBarItem2
+ '
+ Me.RibbonGalleryBarItem2.Caption = "RibbonGalleryBarItem2"
+ '
+ '
+ '
+ Me.RibbonGalleryBarItem2.Gallery.CheckDrawMode = DevExpress.XtraBars.Ribbon.Gallery.CheckDrawMode.ImageAndText
+ Me.RibbonGalleryBarItem2.Gallery.ItemCheckMode = DevExpress.XtraBars.Ribbon.Gallery.ItemCheckMode.SingleRadio
+ Me.RibbonGalleryBarItem2.Gallery.ShowItemText = True
+ Me.RibbonGalleryBarItem2.Id = 5
+ Me.RibbonGalleryBarItem2.Name = "RibbonGalleryBarItem2"
+ '
+ 'chkClearPlaceholders
+ '
+ Me.chkClearPlaceholders.Caption = "Platzhalter nach Ausführung leeren"
+ Me.chkClearPlaceholders.Id = 9
+ Me.chkClearPlaceholders.ImageOptions.SvgImage = Global.DigitalData.Controls.SQLEditor.My.Resources.Resources.cleartablestyle
+ Me.chkClearPlaceholders.Name = "chkClearPlaceholders"
+ '
+ 'btnClearPlaceholders
+ '
+ Me.btnClearPlaceholders.Caption = "Platzhalter jetzt leeren"
+ Me.btnClearPlaceholders.Id = 10
+ Me.btnClearPlaceholders.ImageOptions.SvgImage = Global.DigitalData.Controls.SQLEditor.My.Resources.Resources.clearall
+ Me.btnClearPlaceholders.Name = "btnClearPlaceholders"
+ '
'RibbonPage1
'
- Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonPageGroup3})
+ Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup3, Me.RibbonPageGroup4, Me.RibbonPageGroup1})
Me.RibbonPage1.Name = "RibbonPage1"
Me.RibbonPage1.Text = "RibbonPage1"
'
- 'RibbonPageGroup1
- '
- Me.RibbonPageGroup1.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far
- Me.RibbonPageGroup1.ItemLinks.Add(Me.RibbonGalleryBarItem1)
- Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
- Me.RibbonPageGroup1.Text = "Platzhalter"
- '
- 'RibbonPageGroup2
- '
- Me.RibbonPageGroup2.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far
- Me.RibbonPageGroup2.ItemLinks.Add(Me.btnEditConnections)
- Me.RibbonPageGroup2.Name = "RibbonPageGroup2"
- Me.RibbonPageGroup2.Text = "Datenbank"
- '
'RibbonPageGroup3
'
Me.RibbonPageGroup3.ItemLinks.Add(Me.btnSave)
@@ -129,6 +143,22 @@ Partial Class frmSQLEditor
Me.RibbonPageGroup3.Name = "RibbonPageGroup3"
Me.RibbonPageGroup3.Text = "Start"
'
+ 'RibbonPageGroup4
+ '
+ Me.RibbonPageGroup4.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far
+ Me.RibbonPageGroup4.ImageOptions.SvgImage = Global.DigitalData.Controls.SQLEditor.My.Resources.Resources.actions_database2
+ Me.RibbonPageGroup4.ItemLinks.Add(Me.RibbonGalleryBarItem2)
+ Me.RibbonPageGroup4.Name = "RibbonPageGroup4"
+ Me.RibbonPageGroup4.Text = "Verbindungen"
+ '
+ 'RibbonPageGroup1
+ '
+ Me.RibbonPageGroup1.ItemLinks.Add(Me.RibbonGalleryBarItem1)
+ Me.RibbonPageGroup1.ItemLinks.Add(Me.chkClearPlaceholders)
+ Me.RibbonPageGroup1.ItemLinks.Add(Me.btnClearPlaceholders)
+ Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
+ Me.RibbonPageGroup1.Text = "Platzhalter"
+ '
'RibbonStatusBar1
'
Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 666)
@@ -163,28 +193,28 @@ Partial Class frmSQLEditor
'
'SplitContainerControl1.Panel2
'
- Me.SplitContainerControl1.Panel2.Controls.Add(Me.GridControl1)
+ Me.SplitContainerControl1.Panel2.Controls.Add(Me.GridPlaceholders)
Me.SplitContainerControl1.Panel2.Text = "Panel2"
Me.SplitContainerControl1.Size = New System.Drawing.Size(1056, 508)
Me.SplitContainerControl1.SplitterPosition = 737
Me.SplitContainerControl1.TabIndex = 4
'
- 'GridControl1
+ 'GridPlaceholders
'
- Me.GridControl1.Dock = System.Windows.Forms.DockStyle.Fill
- Me.GridControl1.Location = New System.Drawing.Point(0, 0)
- Me.GridControl1.MainView = Me.GridView1
- Me.GridControl1.MenuManager = Me.RibbonControl1
- Me.GridControl1.Name = "GridControl1"
- Me.GridControl1.Size = New System.Drawing.Size(309, 508)
- Me.GridControl1.TabIndex = 0
- Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
+ Me.GridPlaceholders.Dock = System.Windows.Forms.DockStyle.Fill
+ Me.GridPlaceholders.Location = New System.Drawing.Point(0, 0)
+ Me.GridPlaceholders.MainView = Me.ViewPlaceholders
+ Me.GridPlaceholders.MenuManager = Me.RibbonControl1
+ Me.GridPlaceholders.Name = "GridPlaceholders"
+ Me.GridPlaceholders.Size = New System.Drawing.Size(309, 508)
+ Me.GridPlaceholders.TabIndex = 0
+ Me.GridPlaceholders.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.ViewPlaceholders})
'
- 'GridView1
+ 'ViewPlaceholders
'
- Me.GridView1.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colPattern, Me.colValue})
- Me.GridView1.GridControl = Me.GridControl1
- Me.GridView1.Name = "GridView1"
+ Me.ViewPlaceholders.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colPattern, Me.colValue})
+ Me.ViewPlaceholders.GridControl = Me.GridPlaceholders
+ Me.ViewPlaceholders.Name = "ViewPlaceholders"
'
'colPattern
'
@@ -224,8 +254,8 @@ Partial Class frmSQLEditor
Me.SplitContainerControl1.Panel2.ResumeLayout(False)
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainerControl1.ResumeLayout(False)
- CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit()
- CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.GridPlaceholders, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.ViewPlaceholders, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -240,13 +270,16 @@ Partial Class frmSQLEditor
Friend WithEvents SvgImageCollection1 As DevExpress.Utils.SvgImageCollection
Friend WithEvents RichEditControl1 As DevExpress.XtraRichEdit.RichEditControl
Friend WithEvents SplitContainerControl1 As DevExpress.XtraEditors.SplitContainerControl
- Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl
- Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
+ Friend WithEvents GridPlaceholders As DevExpress.XtraGrid.GridControl
+ Friend WithEvents ViewPlaceholders As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents btnEditConnections As DevExpress.XtraBars.BarButtonItem
- Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents btnSave As DevExpress.XtraBars.BarButtonItem
Friend WithEvents btnExecuteSQL As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RibbonPageGroup3 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents colPattern As DevExpress.XtraGrid.Columns.GridColumn
Friend WithEvents colValue As DevExpress.XtraGrid.Columns.GridColumn
+ Friend WithEvents RibbonGalleryBarItem2 As DevExpress.XtraBars.RibbonGalleryBarItem
+ Friend WithEvents RibbonPageGroup4 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
+ Friend WithEvents chkClearPlaceholders As DevExpress.XtraBars.BarCheckItem
+ Friend WithEvents btnClearPlaceholders As DevExpress.XtraBars.BarButtonItem
End Class
diff --git a/Controls.SQLEditor/frmSQLEditor.vb b/Controls.SQLEditor/frmSQLEditor.vb
index 92f579c7..a23ed4d2 100644
--- a/Controls.SQLEditor/frmSQLEditor.vb
+++ b/Controls.SQLEditor/frmSQLEditor.vb
@@ -7,16 +7,20 @@ Imports DigitalData.Modules.Patterns
Public Class frmSQLEditor
- Private Patterns As ClassPatterns
- Private LogConfig As LogConfig
- Private Database As MSSQLServer
+ Private ReadOnly Patterns As ClassPatterns
+ Private ReadOnly LogConfig As LogConfig
+ Private ReadOnly Database As MSSQLServer
+ Private ReadOnly Placeholders As Placeholders
+
+ Private ClearPlaceholdersAfterSuccessfulExecute As Boolean = False
+ Private FormLoading As Boolean = False
Public Enum PlaceholderCollection
Globix
Zooflow
End Enum
- Public Sub SetPlaceholders()
+ Public Sub SetPlaceholders(pCollection As PlaceholderCollection)
End Sub
@@ -27,71 +31,94 @@ Public Class frmSQLEditor
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
LogConfig = pLogConfig
Database = pDatabase
+ Patterns = New ClassPatterns(LogConfig)
+ Placeholders = New Placeholders()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Patterns = New ClassPatterns(LogConfig)
+ FormLoading = True
+ Try
+ Dim oConnectionGroups = LoadConnections()
+ RibbonGalleryBarItem2.Gallery.Groups.AddRange(oConnectionGroups.ToArray)
- Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Gruppe 1"}
- Dim oGroup2 = New GalleryItemGroup() With {.Caption = "Gruppe 2"}
- Dim oGroup3 = New GalleryItemGroup() With {.Caption = "Gruppe 3"}
+ Dim oPlaceholderGroups = LoadPlaceholders()
+ RibbonGalleryBarItem1.Gallery.Groups.AddRange(oPlaceholderGroups.ToArray)
- Dim oItems As New List(Of GalleryItem)() From {
- GetGalleryItem(New Placeholder("StringValue1", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue1")),
- GetGalleryItem(New Placeholder("StringValue2", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue2")),
- GetGalleryItem(New Placeholder("StringValue3", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue3")),
- GetGalleryItem(New Placeholder("StringValue4", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue4")),
- GetGalleryItem(New Placeholder("StringValue5", "Index", Placeholder.PlaceholderType.FileFlow, "StringValue5"))
+ ConfigureRichEditControl()
+
+ chkClearPlaceholders.Checked = ClearPlaceholdersAfterSuccessfulExecute
+ Catch ex As Exception
+ Finally
+ FormLoading = False
+ End Try
+
+ End Sub
+
+ Private Sub RibbonGalleryBarItem1_GalleryItemClick(sender As Object, e As GalleryItemClickEventArgs) Handles RibbonGalleryBarItem1.GalleryItemClick
+ Dim oPlaceholder As Placeholder = e.Item.Tag
+ Dim pPosition = RichEditControl1.Document.CaretPosition
+ RichEditControl1.Document.InsertSingleLineText(pPosition, Patterns.WrapPatternValue(oPlaceholder.Module, oPlaceholder.Name))
+ End Sub
+
+ Private Function LoadPlaceholders() As List(Of GalleryItemGroup)
+ Dim oInternalPlaceholders = Placeholders.GetInternalGroup()
+ Dim oUserPlaceholder = Placeholders.GetUserGroup()
+
+ Return New List(Of GalleryItemGroup)() From {
+ oInternalPlaceholders,
+ oUserPlaceholder
}
+ End Function
- oGroup1.Items.AddRange(oItems.ToArray)
- oGroup2.Items.AddRange(oItems.ToArray)
- oGroup3.Items.AddRange(oItems.ToArray)
+ Private Function LoadConnections() As List(Of GalleryItemGroup)
+ Try
+ Dim oSql = "SELECT GUID, Bezeichnung FROM [DD_ECM].[dbo].[TBDD_CONNECTION] WHERE AKTIV = 1"
+ Dim oTable = Database.GetDatatable(oSql)
+ Dim oConnections = New List(Of Connection)
- RibbonGalleryBarItem1.Gallery.Groups.AddRange(New List(Of GalleryItemGroup)() From {oGroup1, oGroup2, oGroup3}.ToArray)
+ For Each oRow As DataRow In oTable.Rows
+ oConnections.Add(New Connection() With {
+ .Id = oRow.Item("GUID"),
+ .Name = oRow.Item("Bezeichnung")})
+ Next
+ Dim oGroup1 = New GalleryItemGroup() With {.Caption = "Verbindungen"}
+ Dim oItems As New List(Of GalleryItem)
+ For Each oConnection In oConnections
+ oItems.Add(GetGalleryItem(oConnection))
+ Next
+ oGroup1.Items.AddRange(oItems.ToArray)
+ Dim oConnectionGroups = New List(Of GalleryItemGroup)() From {oGroup1}
+
+ Return oConnectionGroups
+ Catch ex As Exception
+ Return Nothing
+ End Try
+ End Function
+
+ Private Sub ConfigureRichEditControl()
RichEditControl1.Options.Search.RegExResultMaxGuaranteedLength = 500
RichEditControl1.ReplaceService(Of ISyntaxHighlightService)(New SQLSyntaxHighlightService(RichEditControl1.Document))
- RichEditControl1.ActiveViewType = DevExpress.XtraRichEdit.RichEditViewType.Draft
+ RichEditControl1.ActiveViewType = DevExpress.XtraRichEdit.RichEditViewType.Simple
RichEditControl1.Document.Sections(0).Page.Width = DevExpress.Office.Utils.Units.InchesToDocumentsF(80.0F)
RichEditControl1.Document.DefaultCharacterProperties.FontName = "Courier New"
RichEditControl1.Document.DefaultCharacterProperties.FontSize = 12
End Sub
- Private Sub RibbonGalleryBarItem1_GalleryItemClick(sender As Object, e As GalleryItemClickEventArgs) Handles RibbonGalleryBarItem1.GalleryItemClick
- Dim oPlaceholder As Placeholder = e.Item.Tag
- MsgBox(oPlaceholder.Name)
- Dim pPosition = RichEditControl1.Document.CaretPosition
- RichEditControl1.Document.InsertSingleLineText(pPosition, oPlaceholder.Value)
+ Private Sub ClearPlaceholders()
+ GridPlaceholders.DataSource = New List(Of Placeholder)
End Sub
- Private Class Placeholder
- Public Type As PlaceholderType
- Public Property Name As String
- Public Property Value As String
- Public Property Pattern As Pattern
-
- Public Category As String
- Public Description As String
-
- Public Enum PlaceholderType
- FileFlow
- End Enum
-
- Public Sub New(pName As String, pDescription As String, pType As PlaceholderType, pCategory As String)
- Name = pName
- Description = pDescription
- Type = pType
- Category = pCategory
- End Sub
- End Class
-
- Private Function GetGalleryItem(pPlaceholder As Placeholder) As GalleryItem
- Return New GalleryItem(Nothing, pPlaceholder.Name, pPlaceholder.Description) With {
- .Tag = pPlaceholder
+ Private Function GetGalleryItem(pConnection As Connection) As GalleryItem
+ Dim oItem = New GalleryItem(Nothing, pConnection.Name, Nothing) With {
+ .Tag = pConnection
}
+
+ oItem.ImageOptions.SvgImage = My.Resources.actions_database
+
+ Return oItem
End Function
Private Property LastPatterns As New List(Of Pattern)
@@ -108,9 +135,9 @@ Public Class frmSQLEditor
Exit Sub
End If
- GridControl1.DataSource = oPatterns.Select(Function(pattern)
- Return New Placeholder(pattern.Value, pattern.Type, Placeholder.PlaceholderType.FileFlow, "") With {.Pattern = pattern}
- End Function).ToList()
+ GridPlaceholders.DataSource = oPatterns.Select(Function(pattern)
+ Return New Placeholder(pattern.Value, pattern.Value, pattern.Type, pattern.Value) With {.Pattern = pattern}
+ End Function).ToList()
LastPatterns = oPatterns
@@ -120,11 +147,46 @@ Public Class frmSQLEditor
Private Async Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnExecuteSQL.ItemClick
Try
Dim oSql = RichEditControl1.Document.Text
+
+ Dim oPlaceholders As List(Of Placeholder) = GridPlaceholders.DataSource
+
+ If oPlaceholders IsNot Nothing Then
+ For Each oPlaceholder In oPlaceholders
+ Dim oWrapped = Patterns.WrapPatternValue(oPlaceholder.Module, oPlaceholder.Name)
+
+ If oPlaceholder.Value Is Nothing Then
+ Throw New ApplicationException($"Der Platzhalter '{oWrapped}' wurde nicht ausgefüllt!")
+ End If
+
+
+ oSql = oSql.Replace(oWrapped, oPlaceholder.Value)
+ Next
+ End If
+
Dim oDatatable = Await Database.GetDatatableAsync(oSql)
Dim oForm As New frmSQLResult(oDatatable)
oForm.Show()
+
+ Catch ex As ApplicationException
+ MsgBox(ex.Message, MsgBoxStyle.Exclamation, Text)
+
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Text)
End Try
End Sub
+
+ Private Class Connection
+ Public Property Id As Integer
+ Public Property Name As String
+ End Class
+
+ Private Sub BarCheckItem1_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles chkClearPlaceholders.CheckedChanged
+ If FormLoading = False Then
+ ClearPlaceholdersAfterSuccessfulExecute = chkClearPlaceholders.Checked
+ End If
+ End Sub
+
+ Private Sub btnClearPlaceholders_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnClearPlaceholders.ItemClick
+ ClearPlaceholders()
+ End Sub
End Class