Browse Source

Add MoreSetting.OracleDisableNvarchar

pull/2/head
skx 4 years ago
parent
commit
9299097e99
  1. 9
      Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs
  2. 9
      Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs
  3. 5
      Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleInsertBuilder.cs
  4. 5
      Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleUpdateBuilder.cs

9
Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs

@ -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)

9
Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs

@ -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; }
}

5
Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleInsertBuilder.cs

@ -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() + "'";
}
}
}

5
Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleUpdateBuilder.cs

@ -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() + "'";
}
}
}

Loading…
Cancel
Save