mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 优化 NoneParameter Oracle 文本超长的问题;
This commit is contained in:
@ -167,7 +167,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
else
|
||||
{
|
||||
object val = col.GetMapValue(d);
|
||||
sb.Append(_commonUtils.GetNoneParamaterSqlValue(dbParams, col.Attribute.MapType, val));
|
||||
sb.Append(_commonUtils.GetNoneParamaterSqlValue(dbParams, "cu", col.Attribute.MapType, val));
|
||||
}
|
||||
if (didx == 0) sb.Append(" as ").Append(col.Attribute.Name);
|
||||
++colidx2;
|
||||
|
@ -23,6 +23,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
public Dictionary<string, bool> _auditValueChangedDict = new Dictionary<string, bool>(StringComparer.CurrentCultureIgnoreCase);
|
||||
public TableInfo _table;
|
||||
public Func<string, string> _tableRule;
|
||||
public string _noneParameterFlag = "c";
|
||||
public bool _noneParameter, _insertIdentity;
|
||||
public int _batchValuesLimit, _batchParameterLimit;
|
||||
public bool _batchAutoTransaction = true;
|
||||
@ -550,7 +551,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
object val = col.GetMapValue(d);
|
||||
if (val == null && col.Attribute.IsNullable == false) val = col.CsType == typeof(string) ? "" : Utils.GetDataReaderValue(col.CsType.NullableTypeOrThis(), null);//#384
|
||||
if (_noneParameter)
|
||||
sb.Append(_commonUtils.GetNoneParamaterSqlValue(specialParams, col.Attribute.MapType, val));
|
||||
sb.Append(_commonUtils.GetNoneParamaterSqlValue(specialParams, _noneParameterFlag, col.Attribute.MapType, val));
|
||||
else
|
||||
{
|
||||
sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}")));
|
||||
@ -563,8 +564,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
onrow?.Invoke(d, didx, sb);
|
||||
++didx;
|
||||
}
|
||||
if (_noneParameter && specialParams.Any())
|
||||
_params = specialParams.ToArray();
|
||||
if (_noneParameter && specialParams.Any()) _params = specialParams.ToArray();
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
_set.Append(", ").Append(_commonUtils.QuoteSqlName(col.Attribute.Name)).Append(" = ");
|
||||
if (_noneParameter)
|
||||
{
|
||||
_set.Append(_commonUtils.GetNoneParamaterSqlValue(_params, col.Attribute.MapType, paramVal));
|
||||
_set.Append(_commonUtils.GetNoneParamaterSqlValue(_params, "u", col.Attribute.MapType, paramVal));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -565,7 +565,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.Append(_commonUtils.QuoteSqlName(col.Attribute.Name)).Append(" = ");
|
||||
sb.Append(thenValue(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, col.Attribute.MapType, col.GetMapValue(_source.First()))));
|
||||
sb.Append(thenValue(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, "u", col.Attribute.MapType, col.GetMapValue(_source.First()))));
|
||||
|
||||
return sb.ToString();
|
||||
|
||||
@ -589,7 +589,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
ToSqlWhen(cwsb, _table.Primarys, d);
|
||||
cwsb.Append(" THEN ");
|
||||
var val = col.GetMapValue(d);
|
||||
cwsb.Append(thenValue(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, col.Attribute.MapType, val)));
|
||||
cwsb.Append(thenValue(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, "u", col.Attribute.MapType, val)));
|
||||
if (val == null || val == DBNull.Value) nulls++;
|
||||
}
|
||||
cwsb.Append(" END");
|
||||
@ -661,7 +661,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
var val = col.GetMapValue(_source.First());
|
||||
if (_noneParameter)
|
||||
sb.Append(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, col.Attribute.MapType, val));
|
||||
sb.Append(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, "u", col.Attribute.MapType, val));
|
||||
else
|
||||
{
|
||||
sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"p_{_paramsSource.Count}")));
|
||||
@ -705,7 +705,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
cwsb.Append(" THEN ");
|
||||
var val = col.GetMapValue(d);
|
||||
if (_noneParameter)
|
||||
cwsb.Append(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, col.Attribute.MapType, val));
|
||||
cwsb.Append(_commonUtils.GetNoneParamaterSqlValue(_paramsSource, "u", col.Attribute.MapType, val));
|
||||
else
|
||||
{
|
||||
cwsb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"p_{_paramsSource.Count}")));
|
||||
|
@ -23,7 +23,7 @@ namespace FreeSql.Internal
|
||||
public abstract class CommonUtils
|
||||
{
|
||||
|
||||
public abstract string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value);
|
||||
public abstract string GetNoneParamaterSqlValue(List<DbParameter> specialParams, string specialParamFlag, Type type, object value);
|
||||
public abstract DbParameter AppendParamter(List<DbParameter> _params, string parameterName, ColumnInfo col, Type type, object value);
|
||||
public abstract DbParameter[] GetDbParamtersByObject(string sql, object obj);
|
||||
public abstract string FormatSql(string sql, params object[] args);
|
||||
|
@ -187,7 +187,7 @@ namespace FreeSql.Internal
|
||||
}
|
||||
try
|
||||
{
|
||||
col.DbDefaultValue = common.GetNoneParamaterSqlValue(new List<DbParameter>(), colattr.MapType, defaultValue);
|
||||
col.DbDefaultValue = common.GetNoneParamaterSqlValue(new List<DbParameter>(), "init", colattr.MapType, defaultValue);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
Reference in New Issue
Block a user