diff --git a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs index 4a56aa0b2..126a5f33a 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs +++ b/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) diff --git a/Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs b/Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs index 43bad2e40..04713c46e 100644 --- a/Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs +++ b/Src/Asp.Net/SqlSugar/Entities/ConnMoreSettings.cs @@ -10,9 +10,14 @@ namespace SqlSugar public bool IsAutoRemoveDataCache { get; set; } public bool IsWithNoLockQuery { get; set; } /// - /// Some MYSQL databases do not support NVarchar set true + /// Some MYSQL databases do not support Nvarchar set true /// - public bool MySqlDisableNarvchar { get; set; } + public bool MySqlDisableNvarchar { get; set; } + + /// + ///Oracle nvarchar partial operation disabled + /// + public bool OracleDisableNvarchar { get; set; } public bool PgSqlIsAutoToLower = true; public int DefaultCacheDurationInSeconds { get; set; } } diff --git a/Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleInsertBuilder.cs b/Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleInsertBuilder.cs index cd73f4a2c..0668f157e 100644 --- a/Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleInsertBuilder.cs +++ b/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() + "'"; } } } diff --git a/Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleUpdateBuilder.cs b/Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleUpdateBuilder.cs index 602322201..abb495876 100644 --- a/Src/Asp.Net/SqlSugar/Realization/Oracle/SqlBuilder/OracleUpdateBuilder.cs +++ b/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() + "'"; } } }