- 兼容 SqlServer varchar/nvarchar 表达式解析,分别解析为:N'' 和 '';

This commit is contained in:
28810
2019-11-20 03:34:55 +08:00
parent b338efc8a2
commit efdc7c8c5d
27 changed files with 440 additions and 86 deletions

View File

@ -1,4 +1,5 @@
using FreeSql.Internal;
using FreeSql.Internal.Model;
using SafeObjectPool;
using System;
using System.Collections;
@ -26,7 +27,7 @@ namespace FreeSql.Sqlite
}
}
static DateTime dt1970 = new DateTime(1970, 1, 1);
public override object AddslashesProcessParam(object param, Type mapType)
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
{
if (param == null) return "NULL";
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
@ -47,7 +48,7 @@ namespace FreeSql.Sqlite
{
var sb = new StringBuilder();
var ie = param as IEnumerable;
foreach (var z in ie) sb.Append(",").Append(AddslashesProcessParam(z, mapType));
foreach (var z in ie) sb.Append(",").Append(AddslashesProcessParam(z, mapType, mapColumn));
return sb.Length == 0 ? "(NULL)" : sb.Remove(0, 1).Insert(0, "(").Append(")").ToString();
}
return string.Concat("'", param.ToString().Replace("'", "''"), "'");

View File

@ -101,11 +101,11 @@ namespace FreeSql.Sqlite
if (objType == null) objType = callExp.Method.DeclaringType;
if (objType != null || objType.IsArrayOrList())
{
tsc?.SetMapTypeTmp(null);
tsc.SetMapColumnTmp(null);
var args1 = getExp(callExp.Arguments[argIndex]);
var oldMapType = tsc?.SetMapTypeReturnOld(tsc?.mapTypeTmp);
var oldMapType = tsc.SetMapTypeReturnOld(tsc.mapTypeTmp);
var left = objExp == null ? null : getExp(objExp);
tsc.SetMapTypeReturnOld(oldMapType);
tsc.SetMapColumnTmp(null).SetMapTypeReturnOld(oldMapType);
switch (callExp.Method.Name)
{
case "Contains":