mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 01:58:13 +08:00
Synchronous code
This commit is contained in:
@@ -16,6 +16,12 @@ namespace SqlSugar
|
||||
csharpTypeName = "short";
|
||||
if (csharpTypeName.ToLower() == "int64")
|
||||
csharpTypeName = "long";
|
||||
if (csharpTypeName.ToLower() == "uint32")
|
||||
csharpTypeName = "int";
|
||||
if (csharpTypeName.ToLower() == "uint16")
|
||||
csharpTypeName = "short";
|
||||
if (csharpTypeName.ToLower() == "uint64")
|
||||
csharpTypeName = "long";
|
||||
if (csharpTypeName.ToLower().IsIn("boolean", "bool"))
|
||||
csharpTypeName = "bool";
|
||||
if (csharpTypeName == "Guid")
|
||||
|
@@ -652,7 +652,7 @@ WHERE upper(t.TABLE_NAME) = upper('{tableName}')
|
||||
}
|
||||
private static void ConvertCreateColumnInfo(DbColumnInfo x)
|
||||
{
|
||||
string[] array = new string[] { "int" };
|
||||
string[] array = new string[] { "int", "date", "clob", "nclob" };
|
||||
if (x.OracleDataType.HasValue())
|
||||
{
|
||||
x.DataType = x.OracleDataType;
|
||||
|
@@ -54,15 +54,32 @@ namespace SqlSugar
|
||||
}
|
||||
public partial class DmMethod : DefaultDbMethod, IDbMethods
|
||||
{
|
||||
|
||||
public override string WeekOfYear(MethodCallExpressionModel mode)
|
||||
{
|
||||
var parameterNameA = mode.Args[0].MemberName;
|
||||
return $"TO_NUMBER(TO_CHAR({parameterNameA}, 'WW')) ";
|
||||
}
|
||||
public override string ParameterKeyWord { get; set; } = ":";
|
||||
public string ForXmlPathLast;
|
||||
public override string GetForXmlPath()
|
||||
{
|
||||
if (string.IsNullOrEmpty(ForXmlPathLast)) return null;
|
||||
return " GROUP BY "+ ForXmlPathLast;
|
||||
}
|
||||
public override string GetStringJoinSelector(string result, string separator)
|
||||
{
|
||||
return $"listagg(to_char({result}),'{separator}') within group(order by {result}) ";
|
||||
if (result.ObjToString().Trim().StartsWith("DISTINCT ", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
int index = result.IndexOf(result, StringComparison.Ordinal); // 找到去掉前缀空格后的位置
|
||||
result = result.Substring(index + 9); // 9 是 "DISTINCT " 的长度
|
||||
ForXmlPathLast = result;
|
||||
return $"listagg(to_char(max({result})),'{separator}') within group(order by max({result})) ";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"listagg(to_char({result}),'{separator}') within group(order by {result}) ";
|
||||
}
|
||||
}
|
||||
public override string ToInt64(MethodCallExpressionModel model)
|
||||
{
|
||||
|
@@ -13,10 +13,12 @@ namespace SqlSugar
|
||||
{
|
||||
public override bool IsActionUpdateColumns { get; set; } = true;
|
||||
public override DbFastestProperties DbFastestProperties { get; set; } = new DbFastestProperties() {
|
||||
HasOffsetTime=true
|
||||
HasOffsetTime=true,
|
||||
IsConvertDateTimeOffsetToDateTime=true
|
||||
};
|
||||
public async Task<int> ExecuteBulkCopyAsync(DataTable dt)
|
||||
{
|
||||
dt = UtilMethods.ConvertDateTimeOffsetToDateTime(dt);
|
||||
if (DbFastestProperties?.IsOffIdentity == true)
|
||||
{
|
||||
var isNoTran = this.Context.Ado.IsNoTran()&&this.Context.CurrentConnectionConfig.IsAutoCloseConnection;
|
||||
|
@@ -54,6 +54,17 @@ namespace SqlSugar
|
||||
{
|
||||
result.DataType = "datetime";
|
||||
}
|
||||
if (IsSqlServerModel())
|
||||
{
|
||||
if (result.DataType.EqualCase("int4"))
|
||||
{
|
||||
result.DataType = "int";
|
||||
}
|
||||
if (result.DataType.EqualCase("int8"))
|
||||
{
|
||||
result.DataType = "bigint";
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -77,5 +88,9 @@ namespace SqlSugar
|
||||
this.Context.DbMaintenance.AddPrimaryKey(tableName, item.DbColumnName);
|
||||
}
|
||||
|
||||
private bool IsSqlServerModel()
|
||||
{
|
||||
return this.Context.CurrentConnectionConfig?.MoreSettings?.DatabaseModel == DbType.SqlServer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user