mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 19:04:58 +08:00
Synchronous code
This commit is contained in:
@@ -555,11 +555,11 @@ WHERE table_name = '"+tableName+"'");
|
|||||||
|
|
||||||
private List<string> GetPrimaryKeyByTableNames(string tableName)
|
private List<string> GetPrimaryKeyByTableNames(string tableName)
|
||||||
{
|
{
|
||||||
string cacheKey = "DbMaintenanceProvider.GetPrimaryKeyByTableNames." + this.SqlBuilder.GetNoTranslationColumnName(tableName).ToLower();
|
//string cacheKey = "DbMaintenanceProvider.GetPrimaryKeyByTableNames." + this.SqlBuilder.GetNoTranslationColumnName(tableName).ToLower();
|
||||||
cacheKey = GetCacheKey(cacheKey);
|
//cacheKey = GetCacheKey(cacheKey);
|
||||||
return this.Context.Utilities.GetReflectionInoCacheInstance().GetOrCreate(cacheKey,
|
//return this.Context.Utilities.GetReflectionInoCacheInstance().GetOrCreate(cacheKey,
|
||||||
() =>
|
// () =>
|
||||||
{
|
// {
|
||||||
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;
|
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;
|
||||||
this.Context.Ado.IsEnableLogEvent = false;
|
this.Context.Ado.IsEnableLogEvent = false;
|
||||||
string sql = @" select distinct cu.COLUMN_name KEYNAME from user_cons_columns cu, user_constraints au
|
string sql = @" select distinct cu.COLUMN_name KEYNAME from user_cons_columns cu, user_constraints au
|
||||||
@@ -568,7 +568,7 @@ WHERE table_name = '"+tableName+"'");
|
|||||||
var pks = this.Context.Ado.SqlQuery<string>(sql);
|
var pks = this.Context.Ado.SqlQuery<string>(sql);
|
||||||
this.Context.Ado.IsEnableLogEvent = oldIsEnableLog;
|
this.Context.Ado.IsEnableLogEvent = oldIsEnableLog;
|
||||||
return pks;
|
return pks;
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetTableComment(string tableName)
|
public string GetTableComment(string tableName)
|
||||||
@@ -686,7 +686,7 @@ WHERE table_name = '"+tableName+"'");
|
|||||||
}
|
}
|
||||||
private static void ConvertCreateColumnInfo(DbColumnInfo x)
|
private static void ConvertCreateColumnInfo(DbColumnInfo x)
|
||||||
{
|
{
|
||||||
string[] array = new string[] { "int","date"};
|
string[] array = new string[] { "int","date","clob","nclob"};
|
||||||
if (x.OracleDataType.HasValue())
|
if (x.OracleDataType.HasValue())
|
||||||
{
|
{
|
||||||
x.DataType = x.OracleDataType;
|
x.DataType = x.OracleDataType;
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public partial class OracleMethod : DefaultDbMethod, IDbMethods
|
public partial class OracleMethod : DefaultDbMethod, IDbMethods
|
||||||
{
|
{
|
||||||
|
public override string UNIX_TIMESTAMP(MethodCallExpressionModel model)
|
||||||
|
{
|
||||||
|
var parameterNameA = model.Args[0].MemberName;
|
||||||
|
return $" (CAST({parameterNameA} AS DATE) - DATE '1970-01-01') * 86400 ";
|
||||||
|
}
|
||||||
public override string IsNullOrEmpty(MethodCallExpressionModel model)
|
public override string IsNullOrEmpty(MethodCallExpressionModel model)
|
||||||
{
|
{
|
||||||
var parameter = model.Args[0];
|
var parameter = model.Args[0];
|
||||||
@@ -238,11 +243,10 @@ namespace SqlSugar
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case DateType.Year:
|
case DateType.Year:
|
||||||
time = 1 * 365;
|
// 每年 = 12 个月
|
||||||
break;
|
return $"ADD_MONTHS({parameter.MemberName}, ({parameter2.MemberName}) * 12)";
|
||||||
case DateType.Month:
|
case DateType.Month:
|
||||||
time = 1 *30;
|
return $"ADD_MONTHS({parameter.MemberName}, {parameter2.MemberName})";
|
||||||
break;
|
|
||||||
case DateType.Day:
|
case DateType.Day:
|
||||||
break;
|
break;
|
||||||
case DateType.Hour:
|
case DateType.Hour:
|
||||||
|
|||||||
@@ -176,6 +176,16 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return Convert.ToInt64(value);
|
return Convert.ToInt64(value);
|
||||||
}
|
}
|
||||||
|
else if (value is TimeSpan ts)
|
||||||
|
{
|
||||||
|
return string.Format(
|
||||||
|
"INTERVAL '{0} {1:D2}:{2:D2}:{3:D2}.{4:D3}' DAY TO SECOND(3)",
|
||||||
|
ts.Days,
|
||||||
|
ts.Hours,
|
||||||
|
ts.Minutes,
|
||||||
|
ts.Seconds,
|
||||||
|
ts.Milliseconds);
|
||||||
|
}
|
||||||
else if (type == UtilConstants.ByteArrayType)
|
else if (type == UtilConstants.ByteArrayType)
|
||||||
{
|
{
|
||||||
++i;
|
++i;
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return OffsetPage();
|
return OffsetPage();
|
||||||
}
|
}
|
||||||
|
else if (this.Take==1&&this.Skip==0)
|
||||||
|
{
|
||||||
|
return OffsetPage();
|
||||||
|
}
|
||||||
var oldTake = Take;
|
var oldTake = Take;
|
||||||
var oldSkip = Skip;
|
var oldSkip = Skip;
|
||||||
var isDistinctPage = IsDistinct && (Take > 1 || Skip > 1);
|
var isDistinctPage = IsDistinct && (Take > 1 || Skip > 1);
|
||||||
@@ -135,6 +139,9 @@ namespace SqlSugar
|
|||||||
string temp = isExternal ? ExternalPageTempalte : PageTempalte;
|
string temp = isExternal ? ExternalPageTempalte : PageTempalte;
|
||||||
return string.Format(temp, sql.ToString(), (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);
|
return string.Format(temp, sql.ToString(), (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);
|
||||||
}
|
}
|
||||||
|
public override string GetExternalOrderBy(string externalOrderBy)
|
||||||
|
{
|
||||||
|
return Regex.Replace(externalOrderBy, @"\""\w+\""\.", "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,16 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return value.ObjToBool() ? "1" : "0";
|
return value.ObjToBool() ? "1" : "0";
|
||||||
}
|
}
|
||||||
|
else if (value is TimeSpan ts)
|
||||||
|
{
|
||||||
|
return string.Format(
|
||||||
|
"INTERVAL '{0} {1:D2}:{2:D2}:{3:D2}.{4:D3}' DAY TO SECOND(3)",
|
||||||
|
ts.Days,
|
||||||
|
ts.Hours,
|
||||||
|
ts.Minutes,
|
||||||
|
ts.Seconds,
|
||||||
|
ts.Milliseconds );
|
||||||
|
}
|
||||||
else if (type == UtilConstants.DateTimeOffsetType)
|
else if (type == UtilConstants.DateTimeOffsetType)
|
||||||
{
|
{
|
||||||
var date = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
|
var date = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
|
||||||
|
|||||||
Reference in New Issue
Block a user