diff --git a/Lib/SqlSugar.dll b/Lib/SqlSugar.dll
index a845dd19bd64e2b19b59d7148f7858605e09ceb9..74e8cdd35f345bfe14ee0c42b2f3f6b24629a658 100644
Binary files a/Lib/SqlSugar.dll and b/Lib/SqlSugar.dll differ
diff --git a/SmartSQL/SmartSQL.Framework/Exporter/DmExporter.cs b/SmartSQL/SmartSQL.Framework/Exporter/DmExporter.cs
index 6b22e1c91207afbc26316e78b1567dc84b423f80..23a93581a455d1373bd874753b19c1f026217040 100644
--- a/SmartSQL/SmartSQL.Framework/Exporter/DmExporter.cs
+++ b/SmartSQL/SmartSQL.Framework/Exporter/DmExporter.cs
@@ -292,7 +292,7 @@ namespace SmartSQL.Framework.Exporter
throw new NotImplementedException();
}
- public override bool UpdateColumnRemark(Column columnInfo, string remark)
+ public override bool UpdateColumnRemark(Column columnInfo, string remark, DbObjectType objectType = DbObjectType.Table)
{
throw new NotImplementedException();
}
diff --git a/SmartSQL/SmartSQL.Framework/Exporter/Exporter.cs b/SmartSQL/SmartSQL.Framework/Exporter/Exporter.cs
index 210b680db3883fa05e5369efeccbc0314ffb4371..21d420c41f8716e830f0752a8c9d5f8bbaa292bd 100644
--- a/SmartSQL/SmartSQL.Framework/Exporter/Exporter.cs
+++ b/SmartSQL/SmartSQL.Framework/Exporter/Exporter.cs
@@ -79,7 +79,7 @@ namespace SmartSQL.Framework.Exporter
///
///
///
- public abstract bool UpdateColumnRemark(Column columnInfo, string remark);
+ public abstract bool UpdateColumnRemark(Column columnInfo, string remark, DbObjectType objectType = DbObjectType.Table);
///
/// 创建表SQL
///
diff --git a/SmartSQL/SmartSQL.Framework/Exporter/IExporter.cs b/SmartSQL/SmartSQL.Framework/Exporter/IExporter.cs
index 5ea80b31f6f2479346ff0fbe27cae6ee9f648bbf..3ce074d37ee4f96a5149274256eca42e45521537 100644
--- a/SmartSQL/SmartSQL.Framework/Exporter/IExporter.cs
+++ b/SmartSQL/SmartSQL.Framework/Exporter/IExporter.cs
@@ -50,7 +50,7 @@ namespace SmartSQL.Framework.Exporter
///
///
///
- bool UpdateColumnRemark(Column columnInfo, string remark);
+ bool UpdateColumnRemark(Column columnInfo, string remark, DbObjectType objectType = DbObjectType.Table);
///
/// 创建表SQL
///
diff --git a/SmartSQL/SmartSQL.Framework/Exporter/MySqlExporter.cs b/SmartSQL/SmartSQL.Framework/Exporter/MySqlExporter.cs
index 8dc1ee2e08831e264717c8f62add795b8a4e4708..baf2e74b2ed5febb9c2c19911552b89132c0f61c 100644
--- a/SmartSQL/SmartSQL.Framework/Exporter/MySqlExporter.cs
+++ b/SmartSQL/SmartSQL.Framework/Exporter/MySqlExporter.cs
@@ -204,6 +204,7 @@ namespace SmartSQL.Framework.Exporter
column.IsNullable = v.IsNullable;
column.DefaultValue = !string.IsNullOrEmpty(v.DefaultValue) && v.DefaultValue.Contains("((") ? v.DefaultValue.Replace("((", "").Replace("))", "") : v.DefaultValue;
column.DataType = v.DataType;
+ column.Length = v.Length;
column.OriginalName = v.DbColumnName;
column.Comment = v.ColumnDescription;
column.IsPrimaryKey = v.IsPrimarykey;
@@ -256,9 +257,34 @@ namespace SmartSQL.Framework.Exporter
///
///
///
- public override bool UpdateColumnRemark(Column columnInfo, string remark)
+ public override bool UpdateColumnRemark(Column columnInfo, string remark, DbObjectType objectType = DbObjectType.Table)
{
- throw new NotSupportedException();
+ var result = false;
+ if (objectType == DbObjectType.Table)
+ {
+ var dbColumn = new DbColumnInfo()
+ {
+ TableName = columnInfo.ObjectId,
+ DbColumnName = columnInfo.DisplayName,
+ IsIdentity = columnInfo.IsIdentity,
+ IsPrimarykey = columnInfo.IsPrimaryKey,
+ IsNullable = columnInfo.IsNullable,
+ Length = columnInfo.Length,
+ DataType = columnInfo.DataType,
+ DefaultValue = columnInfo.DefaultValue,
+ ColumnDescription = remark
+ };
+ result = _dbMaintenance.AddColumnRemark(dbColumn);
+ }
+ if (objectType == DbObjectType.View)
+ {
+ throw new NotSupportedException();
+ }
+ if (objectType == DbObjectType.Proc)
+ {
+ throw new NotSupportedException();
+ }
+ return result;
}
public override string CreateTableSql()
diff --git a/SmartSQL/SmartSQL.Framework/Exporter/OracleExporter.cs b/SmartSQL/SmartSQL.Framework/Exporter/OracleExporter.cs
index 88aa7de06a5f85f04455e4e3f37496a58801f4ec..630caaec0bf225757abacb1fd2afdba6108f122f 100644
--- a/SmartSQL/SmartSQL.Framework/Exporter/OracleExporter.cs
+++ b/SmartSQL/SmartSQL.Framework/Exporter/OracleExporter.cs
@@ -227,7 +227,7 @@ namespace SmartSQL.Framework.Exporter
///
///
///
- public override bool UpdateColumnRemark(Column columnInfo, string remark)
+ public override bool UpdateColumnRemark(Column columnInfo, string remark, DbObjectType objectType = DbObjectType.Table)
{
throw new NotImplementedException();
}
diff --git a/SmartSQL/SmartSQL.Framework/Exporter/PostgreSqlExporter.cs b/SmartSQL/SmartSQL.Framework/Exporter/PostgreSqlExporter.cs
index 44d27b35bc290e2bd356096748e5afdf3bc80d14..01885244a0e2d55a7e9ab5b57b59d6684d54d11a 100644
--- a/SmartSQL/SmartSQL.Framework/Exporter/PostgreSqlExporter.cs
+++ b/SmartSQL/SmartSQL.Framework/Exporter/PostgreSqlExporter.cs
@@ -272,7 +272,7 @@ namespace SmartSQL.Framework.Exporter
///
///
///
- public override bool UpdateColumnRemark(Column columnInfo, string remark)
+ public override bool UpdateColumnRemark(Column columnInfo, string remark, DbObjectType objectType = DbObjectType.Table)
{
throw new NotImplementedException();
}
diff --git a/SmartSQL/SmartSQL.Framework/Exporter/SqlServerExporter.cs b/SmartSQL/SmartSQL.Framework/Exporter/SqlServerExporter.cs
index 96124909d2b1587bbe2a34f4f72c0ed4d41510b9..4bdd8e4291a33fe34fee2331d8a0bad3633f6eb0 100644
--- a/SmartSQL/SmartSQL.Framework/Exporter/SqlServerExporter.cs
+++ b/SmartSQL/SmartSQL.Framework/Exporter/SqlServerExporter.cs
@@ -472,7 +472,7 @@ namespace SmartSQL.Framework.Exporter
///
///
///
- public override bool UpdateColumnRemark(Column columnInfo, string remark)
+ public override bool UpdateColumnRemark(Column columnInfo, string remark, DbObjectType objectType = DbObjectType.Table)
{
var columnName = columnInfo.Name;
var tableName = columnInfo.ObjectName;
diff --git a/SmartSQL/SmartSQL.Framework/Exporter/SqliteExporter.cs b/SmartSQL/SmartSQL.Framework/Exporter/SqliteExporter.cs
index 2302d146454e187c704b74385ee174739e9846cd..1ace146bd0f4c675e96d9a211e195c8a13786c57 100644
--- a/SmartSQL/SmartSQL.Framework/Exporter/SqliteExporter.cs
+++ b/SmartSQL/SmartSQL.Framework/Exporter/SqliteExporter.cs
@@ -128,7 +128,7 @@ namespace SmartSQL.Framework.Exporter
///
///
///
- public override bool UpdateColumnRemark(Column columnInfo, string remark)
+ public override bool UpdateColumnRemark(Column columnInfo, string remark, DbObjectType objectType = DbObjectType.Table)
{
throw new NotImplementedException();
}
diff --git a/SmartSQL/SmartSQL/UserControl/Main/UcMainColumns.xaml.cs b/SmartSQL/SmartSQL/UserControl/Main/UcMainColumns.xaml.cs
index 3450d0dcd1cecb9ca62b5e69fb8123bc60bf3e2e..89e73ae29990099d0da40d4469abd91202b92eea 100644
--- a/SmartSQL/SmartSQL/UserControl/Main/UcMainColumns.xaml.cs
+++ b/SmartSQL/SmartSQL/UserControl/Main/UcMainColumns.xaml.cs
@@ -133,7 +133,7 @@ namespace SmartSQL.UserControl
var objName = isView ? "视图" : "表";
TabStruct.Header = objName;
TabData.Header = objName;
- var dbInstance = ExporterFactory.CreateInstance(selectedConnection.DbType, dbConnectionString,selectedDatabase.DbName);
+ var dbInstance = ExporterFactory.CreateInstance(selectedConnection.DbType, dbConnectionString, selectedDatabase.DbName);
Task.Run(() =>
{
var tableColumns = dbInstance.GetColumnInfoById(selectedObject.ObejcetId);
@@ -173,7 +173,7 @@ namespace SmartSQL.UserControl
TabCode.Visibility = Visibility.Collapsed;
TabSql.Visibility = Visibility.Visible;
TabTable.SelectedItem = TabSql;
- var dbInstance = ExporterFactory.CreateInstance(selectedConnection.DbType, dbConnectionString,selectedDatabase.DbName);
+ var dbInstance = ExporterFactory.CreateInstance(selectedConnection.DbType, dbConnectionString, selectedDatabase.DbName);
Task.Run(() =>
{
var script = dbInstance.GetScriptInfoById(selectedObject.ObejcetId, DbObjectType.Proc);
@@ -218,7 +218,7 @@ namespace SmartSQL.UserControl
if (selectedItem.Name.Equals("TabData"))
{
var connectionString = SelectedConnection.DbMasterConnectString;
- var exporter = ExporterFactory.CreateInstance(SelectedConnection.DbType, connectionString,SelectedDataBase.DbName);
+ var exporter = ExporterFactory.CreateInstance(SelectedConnection.DbType, connectionString, SelectedDataBase.DbName);
if (TabData.IsSelected)
{
SearchTableExt2.Text = "";
@@ -309,8 +309,9 @@ namespace SmartSQL.UserControl
var dbConnectionString = SelectedConnection.SelectedDbConnectString(SelectedDataBase.DbName);
try
{
- var dbInstance = ExporterFactory.CreateInstance(SelectedConnection.DbType, dbConnectionString,SelectedDataBase.DbName);
- var editResult = dbInstance.UpdateColumnRemark(selectItem, newValue);
+ var dbInstance = ExporterFactory.CreateInstance(SelectedConnection.DbType, dbConnectionString, SelectedDataBase.DbName);
+ var objectType = SelectedObject.Type.Equals(ObjType.Table) ? DbObjectType.Table : (SelectedObject.Type.Equals(ObjType.View) ? DbObjectType.View : DbObjectType.Proc);
+ var editResult = dbInstance.UpdateColumnRemark(selectItem, newValue, objectType);
if (editResult)
Oops.Success("修改成功");
else