miniSql

创建
zgc123@gmail.com authored at 11/19/2023 1:40:15 AM
6136600
Tree
0 Parent(s)
Summary: 10 changed files with 143 additions and 0 deletions.
Added +9 -0
Added +7 -0
Added +1 -0
Added +4 -0
Added +26 -0
Added +8 -0
Added +8 -0
Added +14 -0
Added +28 -0
Added +38 -0
Added +9 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/Create Table.sql.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/Create Table.sql.mt
new file mode 100644
index 0000000..dcf75f1
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/Create Table.sql.mt
@@ -0,0 +1,9 @@
+#@get TableName
+IF OBJECT_ID('${TableName}', 'U') IS NOT NULL
+  DROP TABLE [${TableName}]
+
+CREATE TABLE [${TableName}]
+(
+	${TableName}Id INT IDENTITY NOT NULL, 
+    CONSTRAINT PK_${TableName}Id PRIMARY KEY (${TableName}Id)
+)
Added +7 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/New.sql.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/New.sql.mt
new file mode 100644
index 0000000..b727d9d
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/New.sql.mt
@@ -0,0 +1,7 @@
+/********************************************************\
+ File: 
+ Name: ${Host.UserName}
+ Date: ${Host.Date("dd MMM yyyy")}
+\********************************************************/
+
+
Added +1 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/New.txt.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/New.txt.mt
new file mode 100644
index 0000000..5f28270
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/New.txt.mt
@@ -0,0 +1 @@
+
\ No newline at end of file
Added +4 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/New.xml.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/New.xml.mt
new file mode 100644
index 0000000..d77d8cd
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/New.xml.mt
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<root>
+  
+</root>
\ No newline at end of file
Added +26 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Advanced Looping.txt.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Advanced Looping.txt.mt
new file mode 100644
index 0000000..18ed558
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Advanced Looping.txt.mt
@@ -0,0 +1,26 @@
+## The following script demonstraits the advanced looping abilities using foreach.
+
+#foreach ($row in ${Data.Get(null, "Categories").Rows})
+#beforeall
+
+	I am before everything
+	
+#before
+		>>> (before each item)
+#each
+			"${Host.Data.ColumnValue($row, "Category Name")}"
+#after
+		<<< (after each item)
+#between
+	(i am between each line)
+#odd
+	[I am an odd row...]
+#even
+	[I am an even row]
+#nodata
+	(I appear if theres no data)
+#afterall
+
+	I am last.
+	
+#end
Added +8 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - CSharp Model.cs.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - CSharp Model.cs.mt
new file mode 100644
index 0000000..36bba22
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - CSharp Model.cs.mt
@@ -0,0 +1,8 @@
+#foreach ($table in $Host.Model.Tables)
+public class ${table.Name}
+{
+#foreach ($c in $table.Columns)
+	public ${c.DbType.SystemType} ${Host.ToPascalCase($c.Name)} { get; set; }
+#end
+}
+#end
Added +8 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Plugin Access.txt.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Plugin Access.txt.mt
new file mode 100644
index 0000000..3d0cee8
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Plugin Access.txt.mt
@@ -0,0 +1,8 @@
+#@import-plugin MiniSqlQuery.PlugIns.CoreApplicationPlugIn
+
+\${MiniSqlQuery_PlugIns_CoreApplicationPlugIn.PluginName}:
+  "${MiniSqlQuery_PlugIns_CoreApplicationPlugIn.PluginName}"
+\${MiniSqlQuery_PlugIns_CoreApplicationPlugIn.PluginDescription}
+  "${MiniSqlQuery_PlugIns_CoreApplicationPlugIn.PluginDescription}"
+
+If the plugin also contains methods etc these can also be executed.
\ No newline at end of file
Added +14 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Tables and Columns and DATA.txt.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Tables and Columns and DATA.txt.mt
new file mode 100644
index 0000000..4f49d3c
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Tables and Columns and DATA.txt.mt
@@ -0,0 +1,14 @@
+ConnectionString: "${Host.Model.ConnectionString}"
+ProviderName: "${Host.Model.ProviderName}"
+
+#foreach ($table in ${Host.Model.Tables})
+Table Data: ${table.FullName} (Row count: ${Data.Get(${table.Schema}, ${table.Name}).Rows.Count})
+
+#set($dataTable = $Host.Data.Get(${table.Schema}, ${table.Name}))
+#foreach ($row in $dataTable.Rows)
+#foreach ($c in ${table.Columns})
+${c.Name}: ${Host.Data.ColumnValue($row, $c.Name)}
+#end ## table columns
+#end ## table rows
+#end ## foreach table
+
Added +28 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Tables and Columns.txt.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Tables and Columns.txt.mt
new file mode 100644
index 0000000..fd60248
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - Tables and Columns.txt.mt
@@ -0,0 +1,28 @@
+ConnectionString: "${Host.Model.ConnectionString}"
+ProviderName: "${Host.Model.ProviderName}"
+
+#foreach ($table in ${Host.Model.Tables})
+Table: ${table.FullName}
+#foreach ($c in ${table.Columns})
+  * Column.Name:     ${c.Name}
+	DbType.Summary:  ${c.DbType.Summary}
+		Name:        ${c.DbType.Name}
+		Length:      ${c.DbType.Length}
+		Precision:   ${c.DbType.Precision}
+		Scale:       ${c.DbType.Scale}
+		SystemType:  ${c.DbType.SystemType}
+	Nullable:        ${c.Nullable}
+	IsKey:           ${c.IsKey}
+	IsUnique:        ${c.IsUnique}
+	IsRowVersion:    ${c.IsRowVersion}
+	IsIdentity:      ${c.IsIdentity}
+	IsAutoIncrement: ${c.IsAutoIncrement}
+	IsReadOnly:      ${c.IsReadOnly}
+	IsWritable:      ${c.IsWritable}
+	HasFK:           ${c.HasFK}
+#if($c.HasFK)
+	 ${c.ForeignKeyReference.ReferenceTable.FullName}.${c.ForeignKeyReference.ReferenceColumn.Name}
+#end ## hasFK
+#end ## foreach column
+#end ## foreach table
+
Added +38 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - WPF View Model.cs.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - WPF View Model.cs.mt
new file mode 100644
index 0000000..35b3a84
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - WPF View Model.cs.mt
@@ -0,0 +1,38 @@
+## Example WPF "View Model" template
+## Assumes the use of something like http://mvvmfoundation.codeplex.com/ for the base classes etc
+
+## NOTE - "WIP"
+
+#foreach ($table in $Host.Model.Tables)
+#set($classNm = ${Host.ToPascalCase($table.Name)} )
+public class ${classNm}ViewModel : ObservableObject
+{
+	private ${classNm}Entity _entity;
+	
+	public ${classNm}ViewModel(${classNm}Entity entity)
+	{
+		_entity = entity;
+	}
+#foreach ($c in $table.Columns)
+#set($nm=$Host.ToPascalCase($c.Name))
+
+	public $c.DbType.SystemType.Name ${nm}
+	{
+		get { return _entity.${nm}; }
+		set
+		{
+			if (_entity.${nm} != value)
+			{
+				_entity.${nm} = value;
+				OnPropertyChanged("${nm}");
+			}
+		}
+	}
+#end
+
+	//TODO - sample commands, save etc
+}
+
+
+
+#end
\ No newline at end of file