Synchronization code

This commit is contained in:
sunkaixuan
2024-03-26 12:09:59 +08:00
parent 606f30b668
commit 5d32ca3e6d
3 changed files with 17 additions and 2 deletions

View File

@@ -108,10 +108,10 @@ namespace SqlSugar
new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@bool), new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@bool),
new KeyValuePair<string, CSharpDataType>("boolean",CSharpDataType.@bool), new KeyValuePair<string, CSharpDataType>("boolean",CSharpDataType.@bool),
new KeyValuePair<string, CSharpDataType>("bit",CSharpDataType.@bool), new KeyValuePair<string, CSharpDataType>("bit",CSharpDataType.@bool),
new KeyValuePair<string, CSharpDataType>("decimal",CSharpDataType.@decimal),
new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@decimal), new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.@decimal),
new KeyValuePair<string, CSharpDataType>("numeric",CSharpDataType.@decimal), new KeyValuePair<string, CSharpDataType>("numeric",CSharpDataType.@decimal),
new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.Single), new KeyValuePair<string, CSharpDataType>("number",CSharpDataType.Single),
new KeyValuePair<string, CSharpDataType>("decimal",CSharpDataType.@decimal),
new KeyValuePair<string, CSharpDataType>("decimal",CSharpDataType.Single), new KeyValuePair<string, CSharpDataType>("decimal",CSharpDataType.Single),
new KeyValuePair<string, CSharpDataType>("dec",CSharpDataType.@decimal), new KeyValuePair<string, CSharpDataType>("dec",CSharpDataType.@decimal),
new KeyValuePair<string, SqlSugar.CSharpDataType>("double precision",CSharpDataType.@double), new KeyValuePair<string, SqlSugar.CSharpDataType>("double precision",CSharpDataType.@double),

View File

@@ -468,6 +468,16 @@ WHERE table_name = '" + tableName + "'");
Length = row["ColumnSize"].ObjToInt(), Length = row["ColumnSize"].ObjToInt(),
Scale = row["numericscale"].ObjToInt() Scale = row["numericscale"].ObjToInt()
}; };
if (column.DataType.EqualCase("number")|| column.DataType.EqualCase("decimal"))
{
column.Length = row["numericprecision"].ObjToInt();
column.Scale = row["numericscale"].ObjToInt();
column.DecimalDigits = row["numericscale"].ObjToInt();
if (column.Length == 38 && column.Scale == 0)
{
column.Length = 22;
}
}
result.Add(column); result.Add(column);
} }
return result; return result;

View File

@@ -49,6 +49,11 @@ namespace SqlSugar
{ {
result = result.Replace(";select @@identity", ""); result = result.Replace(";select @@identity", "");
} }
if (this.IsOffIdentity)
{
var tableName = this.GetTableNameString;
result = $"SET IDENTITY_INSERT {tableName} ON;" + result.TrimEnd(';') + $";SET IDENTITY_INSERT {tableName} OFF"; ;
}
return result; return result;
} }