mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- continue
This commit is contained in:
parent
5ad0fd8b75
commit
ffc6831bbd
@ -153,12 +153,7 @@ namespace FreeSql.ClickHouse
|
|||||||
if (value == null) return "NULL";
|
if (value == null) return "NULL";
|
||||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||||
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
if (value is Array)
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
value = $"{Math.Floor(ts.TotalHours)}:{ts.Minutes}:{ts.Seconds}";
|
|
||||||
}
|
|
||||||
else if (value is Array)
|
|
||||||
{
|
{
|
||||||
var valueArr = value as Array;
|
var valueArr = value as Array;
|
||||||
var eleType = type.GetElementType();
|
var eleType = type.GetElementType();
|
||||||
|
@ -102,11 +102,6 @@ namespace FreeSql.Custom.MySql
|
|||||||
if (value == null) return "NULL";
|
if (value == null) return "NULL";
|
||||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||||
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
value = $"{Math.Floor(ts.TotalHours)}:{ts.Minutes}:{ts.Seconds}";
|
|
||||||
}
|
|
||||||
return FormatSql("{0}", value, 1);
|
return FormatSql("{0}", value, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,12 +136,7 @@ namespace FreeSql.Custom.PostgreSQL
|
|||||||
value = getParamterValue(type, value);
|
value = getParamterValue(type, value);
|
||||||
var type2 = value.GetType();
|
var type2 = value.GetType();
|
||||||
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
||||||
if (type2 == typeof(TimeSpan) || type2 == typeof(TimeSpan?))
|
if (value is Array)
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
return $"'{Math.Min(24, (int)Math.Floor(ts.TotalHours))}:{ts.Minutes}:{ts.Seconds}'";
|
|
||||||
}
|
|
||||||
else if (value is Array)
|
|
||||||
{
|
{
|
||||||
var valueArr = value as Array;
|
var valueArr = value as Array;
|
||||||
var eleType = type2.GetElementType();
|
var eleType = type2.GetElementType();
|
||||||
|
@ -98,11 +98,6 @@ namespace FreeSql.Custom.SqlServer
|
|||||||
if (value == null) return "NULL";
|
if (value == null) return "NULL";
|
||||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||||
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
value = $"{ts.Hours}:{ts.Minutes}:{ts.Seconds}.{ts.Milliseconds}";
|
|
||||||
}
|
|
||||||
return string.Format(CultureInfo.InvariantCulture, "{0}", (_orm.Ado as AdoProvider).AddslashesProcessParam(value, type, col));
|
return string.Format(CultureInfo.InvariantCulture, "{0}", (_orm.Ado as AdoProvider).AddslashesProcessParam(value, type, col));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,11 +89,6 @@ namespace FreeSql.Firebird
|
|||||||
if (value == null) return "NULL";
|
if (value == null) return "NULL";
|
||||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||||
if (type == typeof(byte[])) return $"x'{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
if (type == typeof(byte[])) return $"x'{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
value = $"{Math.Floor(ts.TotalHours)}:{ts.Minutes}:{ts.Seconds}";
|
|
||||||
}
|
|
||||||
return FormatSql("{0}", value, 1);
|
return FormatSql("{0}", value, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,11 +95,6 @@ namespace FreeSql.GBase
|
|||||||
var pam = AppendParamter(specialParams, "", null, type, value);
|
var pam = AppendParamter(specialParams, "", null, type, value);
|
||||||
return pam.ParameterName;
|
return pam.ParameterName;
|
||||||
}
|
}
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
return $"interval({ts.Days} {ts.Hours}:{ts.Minutes}:{ts.Seconds}.{ts.Milliseconds}) day(9) to fraction";
|
|
||||||
}
|
|
||||||
if (type == typeof(DateTime))
|
if (type == typeof(DateTime))
|
||||||
{
|
{
|
||||||
if (Utils.TypeHandlers.TryGetValue(typeof(DateTime), out var typeHandler)) return FormatSql("{0}", typeHandler.Serialize(value), 1);
|
if (Utils.TypeHandlers.TryGetValue(typeof(DateTime), out var typeHandler)) return FormatSql("{0}", typeHandler.Serialize(value), 1);
|
||||||
|
@ -131,12 +131,7 @@ namespace FreeSql.KingbaseES
|
|||||||
value = getParamterValue(type, value);
|
value = getParamterValue(type, value);
|
||||||
var type2 = value.GetType();
|
var type2 = value.GetType();
|
||||||
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
||||||
if (type2 == typeof(TimeSpan) || type2 == typeof(TimeSpan?))
|
if (value is Array)
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
return $"'{Math.Min(24, (int)Math.Floor(ts.TotalHours))}:{ts.Minutes}:{ts.Seconds}'";
|
|
||||||
}
|
|
||||||
else if (value is Array)
|
|
||||||
{
|
{
|
||||||
var valueArr = value as Array;
|
var valueArr = value as Array;
|
||||||
var eleType = type2.GetElementType();
|
var eleType = type2.GetElementType();
|
||||||
|
@ -87,11 +87,6 @@ namespace FreeSql.MsAccess
|
|||||||
if (value == null) return "NULL";
|
if (value == null) return "NULL";
|
||||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||||
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
value = $"{ts.Hours}:{ts.Minutes}:{ts.Seconds}";
|
|
||||||
}
|
|
||||||
return FormatSql("{0}", value, 1);
|
return FormatSql("{0}", value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,11 +134,6 @@ namespace FreeSql.MySql
|
|||||||
if (value == null) return "NULL";
|
if (value == null) return "NULL";
|
||||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||||
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
value = $"{Math.Floor(ts.TotalHours)}:{ts.Minutes}:{ts.Seconds}";
|
|
||||||
}
|
|
||||||
return FormatSql("{0}", value, 1);
|
return FormatSql("{0}", value, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,12 +130,7 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
value = getParamterValue(type, value);
|
value = getParamterValue(type, value);
|
||||||
var type2 = value.GetType();
|
var type2 = value.GetType();
|
||||||
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
||||||
if (type2 == typeof(TimeSpan) || type2 == typeof(TimeSpan?))
|
if (value is Array)
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
return $"'{Math.Min(24, (int)Math.Floor(ts.TotalHours))}:{ts.Minutes}:{ts.Seconds}'";
|
|
||||||
}
|
|
||||||
else if (value is Array)
|
|
||||||
{
|
{
|
||||||
var valueArr = value as Array;
|
var valueArr = value as Array;
|
||||||
var eleType = type2.GetElementType();
|
var eleType = type2.GetElementType();
|
||||||
|
@ -98,11 +98,6 @@ namespace FreeSql.Odbc.MySql
|
|||||||
if (value == null) return "NULL";
|
if (value == null) return "NULL";
|
||||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||||
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
value = $"{Math.Floor(ts.TotalHours)}:{ts.Minutes}:{ts.Seconds}";
|
|
||||||
}
|
|
||||||
return FormatSql("{0}", value, 1);
|
return FormatSql("{0}", value, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,12 +130,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
value = getParamterValue(type, value);
|
value = getParamterValue(type, value);
|
||||||
var type2 = value.GetType();
|
var type2 = value.GetType();
|
||||||
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
||||||
if (type2 == typeof(TimeSpan) || type2 == typeof(TimeSpan?))
|
if (value is Array)
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
return $"'{Math.Min(24, (int)Math.Floor(ts.TotalHours))}:{ts.Minutes}:{ts.Seconds}'";
|
|
||||||
}
|
|
||||||
else if (value is Array)
|
|
||||||
{
|
{
|
||||||
var valueArr = value as Array;
|
var valueArr = value as Array;
|
||||||
var eleType = type2.GetElementType();
|
var eleType = type2.GetElementType();
|
||||||
|
@ -92,11 +92,6 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
if (value == null) return "NULL";
|
if (value == null) return "NULL";
|
||||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||||
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
value = $"{ts.Hours}:{ts.Minutes}:{ts.Seconds}.{ts.Milliseconds}";
|
|
||||||
}
|
|
||||||
return string.Format(CultureInfo.InvariantCulture, "{0}", (_orm.Ado as AdoProvider).AddslashesProcessParam(value, type, col));
|
return string.Format(CultureInfo.InvariantCulture, "{0}", (_orm.Ado as AdoProvider).AddslashesProcessParam(value, type, col));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,12 +186,7 @@ namespace FreeSql.PostgreSQL
|
|||||||
value = getParamterValue(type, value);
|
value = getParamterValue(type, value);
|
||||||
var type2 = value.GetType();
|
var type2 = value.GetType();
|
||||||
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
||||||
if (type2 == typeof(TimeSpan) || type2 == typeof(TimeSpan?))
|
if (value is Array)
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
return $"'{Math.Min(24, (int)Math.Floor(ts.TotalHours))}:{ts.Minutes}:{ts.Seconds}'";
|
|
||||||
}
|
|
||||||
else if (value is Array)
|
|
||||||
{
|
{
|
||||||
var valueArr = value as Array;
|
var valueArr = value as Array;
|
||||||
var eleType = type2.GetElementType();
|
var eleType = type2.GetElementType();
|
||||||
|
@ -144,14 +144,7 @@ namespace FreeSql.ShenTong
|
|||||||
value = getParamterValue(type, value);
|
value = getParamterValue(type, value);
|
||||||
var type2 = value.GetType();
|
var type2 = value.GetType();
|
||||||
if (type2 == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
if (type2 == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||||
if (type2 == typeof(TimeSpan) || type2 == typeof(TimeSpan?))
|
if (value is Array)
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
var hh = Math.Min(24, (int)Math.Floor(ts.TotalHours));
|
|
||||||
if (hh >= 24) hh = 0;
|
|
||||||
value = $"{hh}:{ts.Minutes}:{ts.Seconds}.{ts.Milliseconds}";
|
|
||||||
}
|
|
||||||
else if (value is Array)
|
|
||||||
{
|
{
|
||||||
var valueArr = value as Array;
|
var valueArr = value as Array;
|
||||||
var eleType = type2.GetElementType();
|
var eleType = type2.GetElementType();
|
||||||
|
@ -108,18 +108,6 @@ namespace FreeSql.SqlServer
|
|||||||
if (value == null) return "NULL";
|
if (value == null) return "NULL";
|
||||||
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
if (type.IsNumberType()) return string.Format(CultureInfo.InvariantCulture, "{0}", value);
|
||||||
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
if (type == typeof(byte[])) return $"0x{CommonUtils.BytesSqlRaw(value as byte[])}";
|
||||||
if (type == typeof(TimeSpan) || type == typeof(TimeSpan?))
|
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
value = $"{ts.Hours}:{ts.Minutes}:{ts.Seconds}.{ts.Milliseconds}";
|
|
||||||
}
|
|
||||||
#if net60
|
|
||||||
if (type == typeof(TimeOnly) || type == typeof(TimeOnly?))
|
|
||||||
{
|
|
||||||
var ts = (TimeOnly)value;
|
|
||||||
value = $"{ts.Hour}:{ts.Minute}:{ts.Second}.{ts.Millisecond}";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return string.Format(CultureInfo.InvariantCulture, "{0}", (_orm.Ado as AdoProvider).AddslashesProcessParam(value, type, col));
|
return string.Format(CultureInfo.InvariantCulture, "{0}", (_orm.Ado as AdoProvider).AddslashesProcessParam(value, type, col));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,12 +149,7 @@ namespace FreeSql.Xugu
|
|||||||
value = getParamterValue(type, value);
|
value = getParamterValue(type, value);
|
||||||
var type2 = value.GetType();
|
var type2 = value.GetType();
|
||||||
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
|
||||||
if (type2 == typeof(TimeSpan) || type2 == typeof(TimeSpan?))
|
if (dicGetParamterValue.ContainsKey(type2.FullName))
|
||||||
{
|
|
||||||
var ts = (TimeSpan)value;
|
|
||||||
return $"'{Math.Min(24, (int)Math.Floor(ts.TotalHours))}:{ts.Minutes}:{ts.Seconds}'";
|
|
||||||
}
|
|
||||||
else if (dicGetParamterValue.ContainsKey(type2.FullName))
|
|
||||||
{
|
{
|
||||||
value = string.Concat(value);
|
value = string.Concat(value);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user