- 调整内部参数化处理逻辑,为以后 Where 条件参数化做准备;

This commit is contained in:
28810
2019-11-22 05:58:17 +08:00
parent 71dbd75a72
commit 12be7f0051
32 changed files with 213 additions and 97 deletions

View File

@ -68,7 +68,7 @@ namespace FreeSql.Odbc.Oracle
else
{
sb.Append(_commonUtils.QuoteWriteParamter(col.Attribute.MapType, _commonUtils.QuoteParamterName($"{col.CsName}_{didx}")));
_params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col.Attribute.MapType, val);
_params[didx * colidx + colidx2] = _commonUtils.AppendParamter(null, $"{col.CsName}_{didx}", col, col.Attribute.MapType, val);
}
++colidx2;
}
@ -110,7 +110,7 @@ namespace FreeSql.Odbc.Oracle
return 0;
}
var identColName = _commonUtils.QuoteSqlName(_identCol.Attribute.Name);
var identParam = _commonUtils.AppendParamter(null, $"{_identCol.CsName}99", _identCol.Attribute.MapType, 0);
var identParam = _commonUtils.AppendParamter(null, $"{_identCol.CsName}99", _identCol, _identCol.Attribute.MapType, 0);
identParam.Direction = ParameterDirection.Output;
sql = $"{sql} RETURNING {identColName} INTO {identParam.ParameterName}";
var dbParms = _params.Concat(new[] { identParam }).ToArray();
@ -179,7 +179,7 @@ namespace FreeSql.Odbc.Oracle
return 0;
}
var identColName = _commonUtils.QuoteSqlName(_identCol.Attribute.Name);
var identParam = _commonUtils.AppendParamter(null, $"{_identCol.CsName}99", _identCol.Attribute.MapType, 0);
var identParam = _commonUtils.AppendParamter(null, $"{_identCol.CsName}99", _identCol, _identCol.Attribute.MapType, 0);
identParam.Direction = ParameterDirection.Output;
sql = $"{sql} RETURNING {identColName} INTO {identParam.ParameterName}";
var dbParms = _params.Concat(new[] { identParam }).ToArray();

View File

@ -16,9 +16,10 @@ namespace FreeSql.Odbc.Oracle
{
}
public override DbParameter AppendParamter(List<DbParameter> _params, string parameterName, Type type, object value)
public override DbParameter AppendParamter(List<DbParameter> _params, string parameterName, ColumnInfo col, Type type, object value)
{
if (string.IsNullOrEmpty(parameterName)) parameterName = $"p_{_params?.Count}";
if (type == null && col != null) type = col.Attribute.MapType ?? col.CsType;
var dbtype = (OdbcType)_orm.CodeFirst.GetDbInfo(type)?.type;
switch (dbtype)
{