Synchronized code

This commit is contained in:
sunkaixuan 2024-12-04 15:05:46 +08:00
parent fb147fb0fa
commit 81e53108fd
4 changed files with 13 additions and 2 deletions

View File

@ -111,7 +111,10 @@ namespace SqlSugar
new KeyValuePair<string, CSharpDataType>("varcharbyte varying",CSharpDataType.@string), new KeyValuePair<string, CSharpDataType>("varcharbyte varying",CSharpDataType.@string),
new KeyValuePair<string, CSharpDataType>("bpcharbyte",CSharpDataType.@string), new KeyValuePair<string, CSharpDataType>("bpcharbyte",CSharpDataType.@string),
new KeyValuePair<string, CSharpDataType>("nvarchar",CSharpDataType.@string), new KeyValuePair<string, CSharpDataType>("nvarchar",CSharpDataType.@string),
new KeyValuePair<string, CSharpDataType>("characterbyte",CSharpDataType.@string),
new KeyValuePair<string, CSharpDataType>("information_schema.character_data",CSharpDataType.@string),
new KeyValuePair<string, CSharpDataType>("uuid",CSharpDataType.Guid), new KeyValuePair<string, CSharpDataType>("uuid",CSharpDataType.Guid),
new KeyValuePair<string, CSharpDataType>("uniqueidentifier",CSharpDataType.Guid),
new KeyValuePair<string, CSharpDataType>("xml",CSharpDataType.@string), new KeyValuePair<string, CSharpDataType>("xml",CSharpDataType.@string),
new KeyValuePair<string, CSharpDataType>("json",CSharpDataType.@string), new KeyValuePair<string, CSharpDataType>("json",CSharpDataType.@string),
new KeyValuePair<string, CSharpDataType>("rowid",CSharpDataType.@string), new KeyValuePair<string, CSharpDataType>("rowid",CSharpDataType.@string),
@ -122,6 +125,8 @@ namespace SqlSugar
new KeyValuePair<string, CSharpDataType>("macaddr",CSharpDataType.@decimal), new KeyValuePair<string, CSharpDataType>("macaddr",CSharpDataType.@decimal),
new KeyValuePair<string, CSharpDataType>("money",CSharpDataType.@decimal), new KeyValuePair<string, CSharpDataType>("money",CSharpDataType.@decimal),
new KeyValuePair<string, CSharpDataType>("timestamp",CSharpDataType.DateTime), new KeyValuePair<string, CSharpDataType>("timestamp",CSharpDataType.DateTime),
new KeyValuePair<string, CSharpDataType>("datetime2",CSharpDataType.DateTime),
new KeyValuePair<string, CSharpDataType>("datetime",CSharpDataType.DateTime),
new KeyValuePair<string, CSharpDataType>("timestamp with time zone",CSharpDataType.DateTime), new KeyValuePair<string, CSharpDataType>("timestamp with time zone",CSharpDataType.DateTime),
new KeyValuePair<string, CSharpDataType>("timestamptz",CSharpDataType.DateTime), new KeyValuePair<string, CSharpDataType>("timestamptz",CSharpDataType.DateTime),
new KeyValuePair<string, CSharpDataType>("timestamp without time zone",CSharpDataType.DateTime), new KeyValuePair<string, CSharpDataType>("timestamp without time zone",CSharpDataType.DateTime),
@ -135,6 +140,7 @@ namespace SqlSugar
new KeyValuePair<string, CSharpDataType>("blob",CSharpDataType.byteArray), new KeyValuePair<string, CSharpDataType>("blob",CSharpDataType.byteArray),
new KeyValuePair<string, CSharpDataType>("bit varying",CSharpDataType.byteArray), new KeyValuePair<string, CSharpDataType>("bit varying",CSharpDataType.byteArray),
new KeyValuePair<string, CSharpDataType>("varbit",CSharpDataType.@byte), new KeyValuePair<string, CSharpDataType>("varbit",CSharpDataType.@byte),
new KeyValuePair<string, CSharpDataType>("rowversion",CSharpDataType.byteArray),
new KeyValuePair<string, CSharpDataType>("regclass",CSharpDataType.@object) new KeyValuePair<string, CSharpDataType>("regclass",CSharpDataType.@object)
}; };

View File

@ -411,7 +411,7 @@ WHERE tgrelid = '" + tableName + "'::regclass");
var sql = $"select count(*) from information_schema.tables where UPPER(table_schema)=UPPER('{GetSchema()}') and UPPER(table_type)=UPPER('BASE TABLE') and UPPER(table_name)=UPPER('{tableName.ToUpper(IsUpper)}')"; var sql = $"select count(*) from information_schema.tables where UPPER(table_schema)=UPPER('{GetSchema()}') and UPPER(table_type)=UPPER('BASE TABLE') and UPPER(table_name)=UPPER('{tableName.ToUpper(IsUpper)}')";
if (IsSqlServerModel()) if (IsSqlServerModel())
{ {
sql = $"select count(*) from information_schema.tables where pg_catalog.UPPER(table_name)=pg_catalog.UPPER('{tableName.ToUpper(IsUpper)}')"; sql = $"select count(*) from information_schema.tables where UPPER(table_schema)=UPPER('{GetSchema()}') and pg_catalog.UPPER(table_name)=pg_catalog.UPPER('{tableName.ToUpper(IsUpper)}')";
} }
return this.Context.Ado.GetInt(sql)>0; return this.Context.Ado.GetInt(sql)>0;
} }

View File

@ -130,6 +130,11 @@ namespace SqlSugar
} }
public override string DateDiff(MethodCallExpressionModel model) public override string DateDiff(MethodCallExpressionModel model)
{ {
if (IsSqlServerModel(model))
{
return base.DateDiff(model);
}
var parameter = (DateType)(Enum.Parse(typeof(DateType), model.Args[0].MemberValue.ObjToString())); var parameter = (DateType)(Enum.Parse(typeof(DateType), model.Args[0].MemberValue.ObjToString()));
var begin = model.Args[1].MemberName; var begin = model.Args[1].MemberName;
var end = model.Args[2].MemberName; var end = model.Args[2].MemberName;

View File

@ -2,7 +2,7 @@
<package > <package >
<metadata> <metadata>
<id>SqlSugarCore</id> <id>SqlSugarCore</id>
<version>5.1.4.171-preview28</version> <version>5.1.4.171-preview29</version>
<authors>sunkaixuan</authors> <authors>sunkaixuan</authors>
<owners>果糖大数据科技</owners> <owners>果糖大数据科技</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl> <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>