mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 完善 [Column(MapType = typeof(byte[]))] 对 Guid/string 的映射支持;
This commit is contained in:
@ -36,6 +36,7 @@ namespace FreeSql.Sqlite
|
||||
if (param == null) return "NULL";
|
||||
if (mapType != null && mapType != param.GetType() && (param is IEnumerable == false || mapType.IsArrayOrList()))
|
||||
param = Utils.GetDataReaderValue(mapType, param);
|
||||
|
||||
if (param is bool || param is bool?)
|
||||
return (bool)param ? 1 : 0;
|
||||
else if (param is string || param is char)
|
||||
@ -48,6 +49,8 @@ namespace FreeSql.Sqlite
|
||||
return string.Concat("'", ((DateTime)param).ToString("yyyy-MM-dd HH:mm:ss"), "'");
|
||||
else if (param is TimeSpan || param is TimeSpan?)
|
||||
return ((TimeSpan)param).Ticks / 10000;
|
||||
else if (param is byte[])
|
||||
return string.Concat("'", Encoding.UTF8.GetString(param as byte[]), "'");
|
||||
else if (param is IEnumerable)
|
||||
return AddslashesIEnumerable(param, mapType, mapColumn);
|
||||
|
||||
|
@ -94,7 +94,6 @@ namespace FreeSql.Sqlite
|
||||
public override string GetNoneParamaterSqlValue(List<DbParameter> specialParams, Type type, object value)
|
||||
{
|
||||
if (value == null) return "NULL";
|
||||
if (type == typeof(byte[])) value = Encoding.UTF8.GetString(value as byte[]);
|
||||
return FormatSql("{0}", value, 1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user