Add MoreSetting.OracleDisableNvarchar

This commit is contained in:
skx
2021-01-16 14:22:33 +08:00
parent e656e15db6
commit 9299097e99
4 changed files with 22 additions and 6 deletions

View File

@@ -323,6 +323,15 @@ namespace SqlSugar
#endregion
#region Private methods
internal string GetN()
{
var N = "N";
if (_Context.CurrentConnectionConfig.MoreSettings != null && _Context.CurrentConnectionConfig.MoreSettings.OracleDisableNvarchar)
{
N = "";
}
return N;
}
private static void CheckDbDependency(ConnectionConfig config)
{
switch (config.DbType)

View File

@@ -10,9 +10,14 @@ namespace SqlSugar
public bool IsAutoRemoveDataCache { get; set; }
public bool IsWithNoLockQuery { get; set; }
/// <summary>
/// Some MYSQL databases do not support NVarchar set true
/// Some MYSQL databases do not support Nvarchar set true
/// </summary>
public bool MySqlDisableNarvchar { get; set; }
public bool MySqlDisableNvarchar { get; set; }
/// <summary>
///Oracle nvarchar partial operation disabled
/// </summary>
public bool OracleDisableNvarchar { get; set; }
public bool PgSqlIsAutoToLower = true;
public int DefaultCacheDurationInSeconds { get; set; }
}

View File

@@ -107,6 +107,7 @@ namespace SqlSugar
}
else
{
string N = this.Context.GetN();
var type = UtilMethods.GetUnderType(value.GetType());
if (type == UtilConstants.StringType && value.ToString().Contains("{SugarSeq:=}"))
{
@@ -136,11 +137,11 @@ namespace SqlSugar
}
else if (type == UtilConstants.StringType || type == UtilConstants.ObjType)
{
return "N'" + value.ToString().ToSqlFilter() + "'";
return N+"'" + value.ToString().ToSqlFilter() + "'";
}
else
{
return "N'" + value.ToString() + "'";
return N+"'" + value.ToString() + "'";
}
}
}

View File

@@ -44,6 +44,7 @@ namespace SqlSugar
}
else
{
string N =this.Context.GetN();
var type = UtilMethods.GetUnderType(value.GetType());
if (type == UtilConstants.DateType)
{
@@ -69,11 +70,11 @@ namespace SqlSugar
}
else if (type == UtilConstants.StringType || type == UtilConstants.ObjType)
{
return "N'" + value.ToString().ToSqlFilter() + "'";
return N + "'" + value.ToString().ToSqlFilter() + "'";
}
else
{
return "N'" + value.ToString() + "'";
return N + "'" + value.ToString() + "'";
}
}
}