mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 12:28:15 +08:00
代码调整
This commit is contained in:
@ -57,7 +57,7 @@ namespace FreeSql.Sqlite {
|
||||
if (_dicCsToDb.TryGetValue(type.FullName, out var trydc)) return new (int, string, string, bool?, object)?(((int)trydc.type, trydc.dbtype, trydc.dbtypeFull, trydc.isnullable, trydc.defaultValue));
|
||||
if (type.IsArray) return null;
|
||||
var enumType = type.IsEnum ? type : null;
|
||||
if (enumType == null && type.FullName.StartsWith("System.Nullable`1[") && type.GenericTypeArguments.Length == 1 && type.GenericTypeArguments.First().IsEnum) enumType = type.GenericTypeArguments.First();
|
||||
if (enumType == null && type.IsNullableType() && type.GenericTypeArguments.Length == 1 && type.GenericTypeArguments.First().IsEnum) enumType = type.GenericTypeArguments.First();
|
||||
if (enumType != null) {
|
||||
var newItem = enumType.GetCustomAttributes(typeof(FlagsAttribute), false).Any() ?
|
||||
(DbType.Int64, "bigint", $"bigint{(type.IsEnum ? " NOT NULL" : "")}", false, type.IsEnum ? false : true, Enum.GetValues(enumType).GetValue(0)) :
|
||||
|
@ -251,10 +251,10 @@ namespace FreeSql.Sqlite {
|
||||
case "AddTicks": return $"datetime({left},(({args1})/10000000)||' seconds')";
|
||||
case "AddYears": return $"datetime({left},({args1})||' years')";
|
||||
case "Subtract":
|
||||
if (exp.Arguments[0].Type.FullName == "System.DateTime" || exp.Arguments[0].Type.GenericTypeArguments.FirstOrDefault()?.FullName == "System.DateTime")
|
||||
return $"(strftime('%s',{left})-strftime('%s',{args1}))";
|
||||
if (exp.Arguments[0].Type.FullName == "System.TimeSpan" || exp.Arguments[0].Type.GenericTypeArguments.FirstOrDefault()?.FullName == "System.TimeSpan")
|
||||
return $"datetime({left},(-{args1})||' seconds')";
|
||||
switch ((exp.Arguments[0].Type.IsNullableType() ? exp.Arguments[0].Type.GenericTypeArguments.FirstOrDefault() : exp.Arguments[0].Type).FullName) {
|
||||
case "System.DateTime": return $"(strftime('%s',{left})-strftime('%s',{args1}))";
|
||||
case "System.TimeSpan": return $"datetime({left},(-{args1})||' seconds')";
|
||||
}
|
||||
break;
|
||||
case "Equals": return $"({left} = {getExp(exp.Arguments[0])})";
|
||||
case "CompareTo": return $"(strftime('%s',{left})-strftime('%s',{args1}))";
|
||||
|
Reference in New Issue
Block a user