mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Update GetSqlString()
This commit is contained in:
parent
44799f9f2e
commit
4cb5bfa326
@ -447,7 +447,7 @@ namespace SqlSugar
|
|||||||
var sqlObj = this.ToSql();
|
var sqlObj = this.ToSql();
|
||||||
var result = sqlObj.Key;
|
var result = sqlObj.Key;
|
||||||
if (result == null) return null;
|
if (result == null) return null;
|
||||||
result = UtilMethods.GetSqlString(this.Context.CurrentConnectionConfig, sqlObj, result);
|
result = UtilMethods.GetSqlString(this.Context.CurrentConnectionConfig, sqlObj);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public KeyValuePair<string, List<SugarParameter>> ToSql()
|
public KeyValuePair<string, List<SugarParameter>> ToSql()
|
||||||
|
@ -58,7 +58,7 @@ namespace SqlSugar
|
|||||||
var sqlObj = this.ToSql();
|
var sqlObj = this.ToSql();
|
||||||
var result = sqlObj.Key;
|
var result = sqlObj.Key;
|
||||||
if (result == null) return null;
|
if (result == null) return null;
|
||||||
result = UtilMethods.GetSqlString(this.Context.CurrentConnectionConfig, sqlObj, result);
|
result = UtilMethods.GetSqlString(this.Context.CurrentConnectionConfig, sqlObj);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public virtual KeyValuePair<string, List<SugarParameter>> ToSql()
|
public virtual KeyValuePair<string, List<SugarParameter>> ToSql()
|
||||||
|
@ -1937,7 +1937,7 @@ namespace SqlSugar
|
|||||||
var sqlObj = this.Clone().ToSql();
|
var sqlObj = this.Clone().ToSql();
|
||||||
var result = sqlObj.Key;
|
var result = sqlObj.Key;
|
||||||
if (result == null) return null;
|
if (result == null) return null;
|
||||||
result = UtilMethods.GetSqlString(this.Context.CurrentConnectionConfig,sqlObj, result);
|
result = UtilMethods.GetSqlString(this.Context.CurrentConnectionConfig,sqlObj);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ namespace SqlSugar
|
|||||||
var sqlObj = this.ToSql();
|
var sqlObj = this.ToSql();
|
||||||
var result = sqlObj.Key;
|
var result = sqlObj.Key;
|
||||||
if (result == null) return null;
|
if (result == null) return null;
|
||||||
result = UtilMethods.GetSqlString(this.Context.CurrentConnectionConfig, sqlObj, result);
|
result = UtilMethods.GetSqlString(this.Context.CurrentConnectionConfig, sqlObj);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,9 +731,22 @@ namespace SqlSugar
|
|||||||
string FirstDay = datetime.AddDays(daydiff).ToString("yyyy-MM-dd");
|
string FirstDay = datetime.AddDays(daydiff).ToString("yyyy-MM-dd");
|
||||||
return Convert.ToDateTime(FirstDay);
|
return Convert.ToDateTime(FirstDay);
|
||||||
}
|
}
|
||||||
|
public static string GetSqlString(DbType dbType, string sql, SugarParameter [] parametres,bool DisableNvarchar=false)
|
||||||
public static string GetSqlString(ConnectionConfig connectionConfig,KeyValuePair<string, List<SugarParameter>> sqlObj, string result)
|
|
||||||
{
|
{
|
||||||
|
if (parametres == null)
|
||||||
|
parametres = new SugarParameter[] { };
|
||||||
|
return GetSqlString(new ConnectionConfig()
|
||||||
|
{
|
||||||
|
DbType = dbType,
|
||||||
|
MoreSettings=new ConnMoreSettings()
|
||||||
|
{
|
||||||
|
DisableNvarchar=DisableNvarchar
|
||||||
|
}
|
||||||
|
},new KeyValuePair<string, List<SugarParameter>>(sql,parametres.ToList()));
|
||||||
|
}
|
||||||
|
public static string GetSqlString(ConnectionConfig connectionConfig,KeyValuePair<string, List<SugarParameter>> sqlObj)
|
||||||
|
{
|
||||||
|
var result = sqlObj.Key;
|
||||||
if (sqlObj.Value != null)
|
if (sqlObj.Value != null)
|
||||||
{
|
{
|
||||||
foreach (var item in sqlObj.Value.OrderByDescending(it => it.ParameterName.Length))
|
foreach (var item in sqlObj.Value.OrderByDescending(it => it.ParameterName.Length))
|
||||||
|
Loading…
Reference in New Issue
Block a user