mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- 完善 MapType byte[] 对 Contains/Parse 表达式解析的处理;#178
This commit is contained in:
parent
0addfc638a
commit
0dec7ff587
@ -110,6 +110,9 @@ namespace FreeSql.Tests
|
|||||||
|
|
||||||
var slslsl = g.oracle.Select<SendInfo>().ToList();
|
var slslsl = g.oracle.Select<SendInfo>().ToList();
|
||||||
|
|
||||||
|
var slsls1Ids = slslsl.Select(a => a.ID).ToArray();
|
||||||
|
var slslss2 = g.oracle.Select<SendInfo>().Where(a => slsls1Ids.Contains(a.ID)).ToList();
|
||||||
|
|
||||||
var mt_codeId = Guid.Parse("2f48c5ca-7257-43c8-9ee2-0e16fa990253");
|
var mt_codeId = Guid.Parse("2f48c5ca-7257-43c8-9ee2-0e16fa990253");
|
||||||
Assert.Equal(1, g.oracle.Insert(new SendInfo { ID = mt_codeId, Code = "mt_code", Binary = Encoding.UTF8.GetBytes("我是mt_code") })
|
Assert.Equal(1, g.oracle.Insert(new SendInfo { ID = mt_codeId, Code = "mt_code", Binary = Encoding.UTF8.GetBytes("我是mt_code") })
|
||||||
.ExecuteAffrows());
|
.ExecuteAffrows());
|
||||||
|
@ -37,7 +37,7 @@ namespace FreeSql.MsAccess
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
|
@ -36,7 +36,7 @@ namespace FreeSql.MySql
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
|
@ -35,7 +35,7 @@ namespace FreeSql.Odbc.Dameng
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is byte[])
|
if (param is byte[])
|
||||||
|
@ -41,7 +41,9 @@ namespace FreeSql.Odbc.Dameng
|
|||||||
case "System.UInt16":
|
case "System.UInt16":
|
||||||
case "System.UInt32":
|
case "System.UInt32":
|
||||||
case "System.UInt64": return $"cast({getExp(operandExp)} as number)";
|
case "System.UInt64": return $"cast({getExp(operandExp)} as number)";
|
||||||
case "System.Guid": return $"to_char({getExp(operandExp)})";
|
case "System.Guid":
|
||||||
|
if (tsc.mapType == typeof(byte[])) return $"hextoraw({getExp(operandExp)})";
|
||||||
|
return $"to_char({getExp(operandExp)})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -68,7 +70,9 @@ namespace FreeSql.Odbc.Dameng
|
|||||||
case "System.UInt16":
|
case "System.UInt16":
|
||||||
case "System.UInt32":
|
case "System.UInt32":
|
||||||
case "System.UInt64": return $"cast({getExp(callExp.Arguments[0])} as number)";
|
case "System.UInt64": return $"cast({getExp(callExp.Arguments[0])} as number)";
|
||||||
case "System.Guid": return $"substr(to_char({getExp(callExp.Arguments[0])}), 1, 36)";
|
case "System.Guid":
|
||||||
|
if (tsc.mapType == typeof(byte[])) return $"hextoraw({getExp(callExp.Arguments[0])})";
|
||||||
|
return $"to_char({getExp(callExp.Arguments[0])})";
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
case "NewGuid":
|
case "NewGuid":
|
||||||
|
@ -37,7 +37,7 @@ namespace FreeSql.Odbc.Default
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
|
@ -37,7 +37,7 @@ namespace FreeSql.Odbc.GBase
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
return (bool)param ? "'t'" : "'f'";
|
return (bool)param ? "'t'" : "'f'";
|
||||||
|
@ -36,7 +36,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
|
@ -35,7 +35,7 @@ namespace FreeSql.Odbc.Oracle
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is byte[])
|
if (param is byte[])
|
||||||
|
@ -41,7 +41,9 @@ namespace FreeSql.Odbc.Oracle
|
|||||||
case "System.UInt16":
|
case "System.UInt16":
|
||||||
case "System.UInt32":
|
case "System.UInt32":
|
||||||
case "System.UInt64": return $"cast({getExp(operandExp)} as number)";
|
case "System.UInt64": return $"cast({getExp(operandExp)} as number)";
|
||||||
case "System.Guid": return $"to_char({getExp(operandExp)})";
|
case "System.Guid":
|
||||||
|
if (tsc.mapType == typeof(byte[])) return $"hextoraw({getExp(operandExp)})";
|
||||||
|
return $"to_char({getExp(operandExp)})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -68,7 +70,9 @@ namespace FreeSql.Odbc.Oracle
|
|||||||
case "System.UInt16":
|
case "System.UInt16":
|
||||||
case "System.UInt32":
|
case "System.UInt32":
|
||||||
case "System.UInt64": return $"cast({getExp(callExp.Arguments[0])} as number)";
|
case "System.UInt64": return $"cast({getExp(callExp.Arguments[0])} as number)";
|
||||||
case "System.Guid": return $"substr(to_char({getExp(callExp.Arguments[0])}), 1, 36)";
|
case "System.Guid":
|
||||||
|
if (tsc.mapType == typeof(byte[])) return $"hextoraw({getExp(callExp.Arguments[0])})";
|
||||||
|
return $"to_char({getExp(callExp.Arguments[0])})";
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
case "NewGuid":
|
case "NewGuid":
|
||||||
|
@ -37,7 +37,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
|
@ -38,7 +38,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
|
@ -35,7 +35,7 @@ namespace FreeSql.Oracle
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is byte[])
|
if (param is byte[])
|
||||||
|
@ -41,7 +41,9 @@ namespace FreeSql.Oracle
|
|||||||
case "System.UInt16":
|
case "System.UInt16":
|
||||||
case "System.UInt32":
|
case "System.UInt32":
|
||||||
case "System.UInt64": return $"cast({getExp(operandExp)} as number)";
|
case "System.UInt64": return $"cast({getExp(operandExp)} as number)";
|
||||||
case "System.Guid": return $"substr(to_char({getExp(operandExp)}), 1, 36)";
|
case "System.Guid":
|
||||||
|
if (tsc.mapType == typeof(byte[])) return $"hextoraw({getExp(operandExp)})";
|
||||||
|
return $"to_char({getExp(operandExp)})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -68,7 +70,9 @@ namespace FreeSql.Oracle
|
|||||||
case "System.UInt16":
|
case "System.UInt16":
|
||||||
case "System.UInt32":
|
case "System.UInt32":
|
||||||
case "System.UInt64": return $"cast({getExp(callExp.Arguments[0])} as number)";
|
case "System.UInt64": return $"cast({getExp(callExp.Arguments[0])} as number)";
|
||||||
case "System.Guid": return $"to_char({getExp(callExp.Arguments[0])})";
|
case "System.Guid":
|
||||||
|
if (tsc.mapType == typeof(byte[])) return $"hextoraw({getExp(callExp.Arguments[0])})";
|
||||||
|
return $"to_char({getExp(callExp.Arguments[0])})";
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
case "NewGuid":
|
case "NewGuid":
|
||||||
|
@ -38,7 +38,7 @@ namespace FreeSql.PostgreSQL
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList() || param is JToken || param is JObject || param is JArray))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || param is JToken || param is JObject || param is JArray))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
bool isdic;
|
bool isdic;
|
||||||
|
@ -39,7 +39,7 @@ namespace FreeSql.SqlServer
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
|
@ -34,7 +34,7 @@ namespace FreeSql.Sqlite
|
|||||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||||
{
|
{
|
||||||
if (param == null) return "NULL";
|
if (param == null) return "NULL";
|
||||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false))
|
||||||
param = Utils.GetDataReaderValue(mapType, param);
|
param = Utils.GetDataReaderValue(mapType, param);
|
||||||
|
|
||||||
if (param is bool || param is bool?)
|
if (param is bool || param is bool?)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user