mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 完成 [Table(AsTable = xx)] 分表特性查询;
This commit is contained in:
parent
abaeb7efd5
commit
980ee1e893
@ -115,8 +115,8 @@ namespace base_entity
|
|||||||
.UseNoneCommandParameter(true)
|
.UseNoneCommandParameter(true)
|
||||||
|
|
||||||
.UseConnectionString(FreeSql.DataType.Sqlite, "data source=test1.db;max pool size=5")
|
.UseConnectionString(FreeSql.DataType.Sqlite, "data source=test1.db;max pool size=5")
|
||||||
.UseSlave("data source=test1.db", "data source=test2.db", "data source=test3.db", "data source=test4.db")
|
//.UseSlave("data source=test1.db", "data source=test2.db", "data source=test3.db", "data source=test4.db")
|
||||||
.UseSlaveWeight(10, 1, 1, 5)
|
//.UseSlaveWeight(10, 1, 1, 5)
|
||||||
|
|
||||||
|
|
||||||
//.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;Max pool size=2")
|
//.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;Max pool size=2")
|
||||||
@ -200,6 +200,26 @@ namespace base_entity
|
|||||||
var sqlatd801 = sqlatd8.ToSql();
|
var sqlatd801 = sqlatd8.ToSql();
|
||||||
var sqlatd802 = sqlatd8.ExecuteAffrows();
|
var sqlatd802 = sqlatd8.ExecuteAffrows();
|
||||||
|
|
||||||
|
var sqls1 = fsql.Select<AsTableLog>();
|
||||||
|
var sqls101 = sqls1.ToSql();
|
||||||
|
var sqls102 = sqls1.ToList();
|
||||||
|
|
||||||
|
var sqls2 = fsql.Select<AsTableLog>().Where(a => a.createtime.Between(DateTime.Parse("2022-3-1"), DateTime.Parse("2022-5-1")));
|
||||||
|
var sqls201 = sqls2.ToSql();
|
||||||
|
var sqls202 = sqls2.ToList();
|
||||||
|
|
||||||
|
var sqls3 = fsql.Select<AsTableLog>().Where(a => a.createtime > DateTime.Parse("2022-3-1") && a.createtime < DateTime.Parse("2022-5-1"));
|
||||||
|
var sqls301 = sqls3.ToSql();
|
||||||
|
var sqls302 = sqls3.ToList();
|
||||||
|
|
||||||
|
var sqls4 = fsql.Select<AsTableLog>().Where(a => a.createtime > DateTime.Parse("2022-3-1"));
|
||||||
|
var sqls401 = sqls4.ToSql();
|
||||||
|
var sqls402 = sqls4.ToList();
|
||||||
|
|
||||||
|
var sqls5 = fsql.Select<AsTableLog>().Where(a => a.createtime < DateTime.Parse("2022-5-1"));
|
||||||
|
var sqls501 = sqls5.ToSql();
|
||||||
|
var sqls502 = sqls5.ToList();
|
||||||
|
|
||||||
fsql.Aop.AuditValue += new EventHandler<FreeSql.Aop.AuditValueEventArgs>((_, e) =>
|
fsql.Aop.AuditValue += new EventHandler<FreeSql.Aop.AuditValueEventArgs>((_, e) =>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -538,14 +538,5 @@
|
|||||||
<param name="that"></param>
|
<param name="that"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
|
||||||
<summary>
|
|
||||||
批量注入 Repository,可以参考代码自行调整
|
|
||||||
</summary>
|
|
||||||
<param name="services"></param>
|
|
||||||
<param name="globalDataFilter"></param>
|
|
||||||
<param name="assemblies"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
@ -76,7 +76,7 @@ namespace FreeSql.DataAnnotations
|
|||||||
ICollection<string> AllTables { get; }
|
ICollection<string> AllTables { get; }
|
||||||
string GetTableNameByColumnValue(object columnValue, bool autoExpand = false);
|
string GetTableNameByColumnValue(object columnValue, bool autoExpand = false);
|
||||||
ICollection<string> GetTableNamesByColumnValueRange(object columnValue1, object columnValue2);
|
ICollection<string> GetTableNamesByColumnValueRange(object columnValue1, object columnValue2);
|
||||||
ICollection<string> GetTableNamesBySqlWhere(string sqlWhere, List<DbParameter> dbParams, TableInfo table, CommonUtils commonUtils);
|
ICollection<string> GetTableNamesBySqlWhere(string sqlWhere, List<DbParameter> dbParams, SelectTableInfo tb, CommonUtils commonUtils);
|
||||||
}
|
}
|
||||||
class DateTimeAsTableImpl : IAsTable
|
class DateTimeAsTableImpl : IAsTable
|
||||||
{
|
{
|
||||||
@ -192,7 +192,7 @@ namespace FreeSql.DataAnnotations
|
|||||||
{
|
{
|
||||||
return _dicRegSqlWhereDateTimes.GetOrAdd($"{columnName},{quoteParameterName}", cn =>
|
return _dicRegSqlWhereDateTimes.GetOrAdd($"{columnName},{quoteParameterName}", cn =>
|
||||||
{
|
{
|
||||||
cn = columnName.Replace(@"\[", @"\\[").Replace(@"\]", @"\\]");
|
cn = columnName.Replace("[", "\\[").Replace("]", "\\]").Replace(".", "\\.");
|
||||||
return new[]
|
return new[]
|
||||||
{
|
{
|
||||||
new Regex($@"({cn}\s*(<|<=|>|>=|=|between)\s*)(datetime|cdate|to_date)\(('[^']+')\)", RegexOptions.IgnoreCase),
|
new Regex($@"({cn}\s*(<|<=|>|>=|=|between)\s*)(datetime|cdate|to_date)\(('[^']+')\)", RegexOptions.IgnoreCase),
|
||||||
@ -239,15 +239,22 @@ namespace FreeSql.DataAnnotations
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="Exception"></exception>
|
/// <exception cref="Exception"></exception>
|
||||||
public ICollection<string> GetTableNamesBySqlWhere(string sqlWhere, List<DbParameter> dbParams, TableInfo table, CommonUtils commonUtils)
|
public ICollection<string> GetTableNamesBySqlWhere(string sqlWhere, List<DbParameter> dbParams, SelectTableInfo tb, CommonUtils commonUtils)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(sqlWhere)) return _allTables;
|
||||||
var quoteParameterName = commonUtils.QuoteParamterName("");
|
var quoteParameterName = commonUtils.QuoteParamterName("");
|
||||||
var quoteParameterNameCharArray = quoteParameterName.ToCharArray();
|
var quoteParameterNameCharArray = quoteParameterName.ToCharArray();
|
||||||
var regs = GetRegSqlWhereDateTimes(commonUtils.QuoteSqlName(table.AsTableColumn.Attribute.Name), quoteParameterName);
|
var columnName = commonUtils.QuoteSqlName(tb.Table.AsTableColumn.Attribute.Name);
|
||||||
|
var regs = GetRegSqlWhereDateTimes($"{(string.IsNullOrWhiteSpace(tb.Alias) ? "" : $"{tb.Alias}.")}{commonUtils.QuoteSqlName(tb.Table.AsTableColumn.Attribute.Name)}", quoteParameterName);
|
||||||
for (var a = 0; a < 16; a++) sqlWhere = regs[a].Replace(sqlWhere, "$1$4");
|
for (var a = 0; a < 16; a++) sqlWhere = regs[a].Replace(sqlWhere, "$1$4");
|
||||||
|
|
||||||
var m = regs[16].Match(sqlWhere);
|
var m = regs[16].Match(sqlWhere);
|
||||||
if (m.Success) return GetTableNamesByColumnValueRange(m.Groups[1].Value, m.Groups[2].Value);
|
if (m.Success) return GetTableNamesByColumnValueRange(m.Groups[1].Value, m.Groups[2].Value);
|
||||||
|
m = m = regs[18].Match(sqlWhere);
|
||||||
|
if (m.Success) return LocalGetTables(m.Groups[1].Value, m.Groups[3].Value, ParseColumnValue(m.Groups[2].Value), ParseColumnValue(m.Groups[4].Value));
|
||||||
|
m = regs[20].Match(sqlWhere);
|
||||||
|
if (m.Success) return LocalGetTables2(m.Groups[1].Value, ParseColumnValue(m.Groups[2].Value));
|
||||||
|
|
||||||
m = m = regs[17].Match(sqlWhere);
|
m = m = regs[17].Match(sqlWhere);
|
||||||
if (m.Success)
|
if (m.Success)
|
||||||
{
|
{
|
||||||
@ -256,8 +263,6 @@ namespace FreeSql.DataAnnotations
|
|||||||
if (val1 == null || val2 == null) throw new Exception($"未能解析分表字段值 {sqlWhere}");
|
if (val1 == null || val2 == null) throw new Exception($"未能解析分表字段值 {sqlWhere}");
|
||||||
return GetTableNamesByColumnValueRange(val1, val2);
|
return GetTableNamesByColumnValueRange(val1, val2);
|
||||||
}
|
}
|
||||||
m = m = regs[18].Match(sqlWhere);
|
|
||||||
if (m.Success) return LocalGetTables(m.Groups[1].Value, m.Groups[3].Value, ParseColumnValue(m.Groups[2].Value), ParseColumnValue(m.Groups[4].Value));
|
|
||||||
m = regs[19].Match(sqlWhere);
|
m = regs[19].Match(sqlWhere);
|
||||||
if (m.Success)
|
if (m.Success)
|
||||||
{
|
{
|
||||||
@ -266,8 +271,6 @@ namespace FreeSql.DataAnnotations
|
|||||||
if (val1 == null || val2 == null) throw new Exception($"未能解析分表字段值 {sqlWhere}");
|
if (val1 == null || val2 == null) throw new Exception($"未能解析分表字段值 {sqlWhere}");
|
||||||
return LocalGetTables(m.Groups[1].Value, m.Groups[3].Value, ParseColumnValue(val1), ParseColumnValue(val2));
|
return LocalGetTables(m.Groups[1].Value, m.Groups[3].Value, ParseColumnValue(val1), ParseColumnValue(val2));
|
||||||
}
|
}
|
||||||
m = regs[20].Match(sqlWhere);
|
|
||||||
if (m.Success) return LocalGetTables2(m.Groups[1].Value, ParseColumnValue(m.Groups[2].Value));
|
|
||||||
m = regs[21].Match(sqlWhere);
|
m = regs[21].Match(sqlWhere);
|
||||||
if (m.Success)
|
if (m.Success)
|
||||||
{
|
{
|
||||||
|
@ -411,7 +411,7 @@
|
|||||||
所有分表名
|
所有分表名
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:FreeSql.DataAnnotations.DateTimeAsTableImpl.GetTableNamesBySqlWhere(System.String,System.Collections.Generic.List{System.Data.Common.DbParameter},FreeSql.Internal.Model.TableInfo,FreeSql.Internal.CommonUtils)">
|
<member name="M:FreeSql.DataAnnotations.DateTimeAsTableImpl.GetTableNamesBySqlWhere(System.String,System.Collections.Generic.List{System.Data.Common.DbParameter},FreeSql.Internal.Model.SelectTableInfo,FreeSql.Internal.CommonUtils)">
|
||||||
<summary>
|
<summary>
|
||||||
可以匹配以下条件(支持参数化):<para></para>
|
可以匹配以下条件(支持参数化):<para></para>
|
||||||
`field` BETWEEN '2022-01-01 00:00:00' AND '2022-03-01 00:00:00'<para></para>
|
`field` BETWEEN '2022-01-01 00:00:00' AND '2022-03-01 00:00:00'<para></para>
|
||||||
|
@ -1690,6 +1690,7 @@ namespace FreeSql.Internal
|
|||||||
public abstract string ExpressionLambdaToSqlCallTimeSpan(MethodCallExpression exp, ExpTSC tsc);
|
public abstract string ExpressionLambdaToSqlCallTimeSpan(MethodCallExpression exp, ExpTSC tsc);
|
||||||
public abstract string ExpressionLambdaToSqlCallConvert(MethodCallExpression exp, ExpTSC tsc);
|
public abstract string ExpressionLambdaToSqlCallConvert(MethodCallExpression exp, ExpTSC tsc);
|
||||||
public abstract string ExpressionLambdaToSqlOther(Expression exp, ExpTSC tsc);
|
public abstract string ExpressionLambdaToSqlOther(Expression exp, ExpTSC tsc);
|
||||||
|
public string ExpressionConstDateTime(Expression exp) => exp is ConstantExpression operandExpConst ? formatSql(Utils.GetDataReaderValue(typeof(DateTime), operandExpConst.Value), null, null, null) : null;
|
||||||
|
|
||||||
public enum ExpressionStyle
|
public enum ExpressionStyle
|
||||||
{
|
{
|
||||||
|
@ -195,7 +195,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
if (_table.AsTableImpl != null)
|
if (_table.AsTableImpl != null)
|
||||||
{
|
{
|
||||||
var names = _table.AsTableImpl.GetTableNamesBySqlWhere(newwhere.ToString(), _params, _table, _commonUtils);
|
var names = _table.AsTableImpl.GetTableNamesBySqlWhere(newwhere.ToString(), _params, new SelectTableInfo { Table = _table }, _commonUtils);
|
||||||
foreach (var name in names)
|
foreach (var name in names)
|
||||||
{
|
{
|
||||||
_tableRule = old => name;
|
_tableRule = old => name;
|
||||||
@ -228,7 +228,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
if (_table.AsTableImpl != null)
|
if (_table.AsTableImpl != null)
|
||||||
{
|
{
|
||||||
var names = _table.AsTableImpl.GetTableNamesBySqlWhere(newwhere.ToString(), _params, _table, _commonUtils);
|
var names = _table.AsTableImpl.GetTableNamesBySqlWhere(newwhere.ToString(), _params, new SelectTableInfo { Table = _table }, _commonUtils);
|
||||||
foreach (var name in names)
|
foreach (var name in names)
|
||||||
{
|
{
|
||||||
_tableRule = old => name;
|
_tableRule = old => name;
|
||||||
|
@ -460,7 +460,54 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
protected List<Dictionary<Type, string>> GetTableRuleUnions()
|
protected List<Dictionary<Type, string>> GetTableRuleUnions()
|
||||||
{
|
{
|
||||||
var unions = new List<Dictionary<Type, string>>();
|
var unions = new List<Dictionary<Type, string>>();
|
||||||
var trs = _tableRules.Any() ? _tableRules : new List<Func<Type, string, string>>(new[] { new Func<Type, string, string>((type, oldname) => null) });
|
var trs = _tableRules.Any() ? _tableRules : new List<Func<Type, string, string>>();
|
||||||
|
|
||||||
|
if (trs.Any() == false)
|
||||||
|
{
|
||||||
|
string[] LocalGetTableNames(SelectTableInfo tb)
|
||||||
|
{
|
||||||
|
if (tb.Table.AsTableImpl != null)
|
||||||
|
{
|
||||||
|
string[] aret = null;
|
||||||
|
if (_where.Length == 0) aret = tb.Table.AsTableImpl.AllTables.ToArray();
|
||||||
|
else aret = tb.Table.AsTableImpl.GetTableNamesBySqlWhere(_where.ToString(), _params, tb, _commonUtils).ToArray();
|
||||||
|
if (aret.Any() == false) aret = tb.Table.AsTableImpl.AllTables.Take(1).ToArray();
|
||||||
|
|
||||||
|
for (var a = 0; a < aret.Length; a++)
|
||||||
|
{
|
||||||
|
if (_orm.CodeFirst.IsSyncStructureToLower) aret[a] = aret[a].ToLower();
|
||||||
|
if (_orm.CodeFirst.IsSyncStructureToUpper) aret[a] = aret[a].ToUpper();
|
||||||
|
if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(tb.Table.Type, aret[a]);
|
||||||
|
}
|
||||||
|
return aret;
|
||||||
|
}
|
||||||
|
return new string[] { tb.Table.DbName };
|
||||||
|
}
|
||||||
|
var tbnames = _tables.GroupBy(a => a.Table.Type).Select(g => _tables.Where(a => a.Table.Type == g.Key).FirstOrDefault()).Select(a => new { Tb = a, Names = LocalGetTableNames(a) }).ToList();
|
||||||
|
var dict = new Dictionary<Type, string>();
|
||||||
|
tbnames.ForEach(a =>
|
||||||
|
{
|
||||||
|
dict.Add(a.Tb.Table.Type, a.Names[0]);
|
||||||
|
});
|
||||||
|
unions.Add(dict);
|
||||||
|
for (var a = 0; a < tbnames.Count; a++)
|
||||||
|
{
|
||||||
|
if (tbnames[a].Names.Length <= 1) continue;
|
||||||
|
var unionsCount = unions.Count;
|
||||||
|
for (var b = 1; b < tbnames[a].Names.Length; b++)
|
||||||
|
{
|
||||||
|
for (var d = 0; d < unionsCount; d++)
|
||||||
|
{
|
||||||
|
dict = new Dictionary<Type, string>();
|
||||||
|
foreach (var uit in unions[d])
|
||||||
|
dict.Add(uit.Key, uit.Key == tbnames[a].Tb.Table.Type ? tbnames[a].Names[b] : uit.Value);
|
||||||
|
unions.Add(dict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return unions;
|
||||||
|
}
|
||||||
|
if (trs.Any() == false) trs.Add(new Func<Type, string, string>((type, oldname) => null));
|
||||||
foreach (var tr in trs)
|
foreach (var tr in trs)
|
||||||
{
|
{
|
||||||
var dict = new Dictionary<Type, string>();
|
var dict = new Dictionary<Type, string>();
|
||||||
|
@ -803,7 +803,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
if (_table.AsTableImpl != null)
|
if (_table.AsTableImpl != null)
|
||||||
{
|
{
|
||||||
var names = _table.AsTableImpl.GetTableNamesBySqlWhere(newwhere.ToString(), _params, _table, _commonUtils);
|
var names = _table.AsTableImpl.GetTableNamesBySqlWhere(newwhere.ToString(), _params, new SelectTableInfo { Table = _table }, _commonUtils);
|
||||||
foreach (var name in names)
|
foreach (var name in names)
|
||||||
{
|
{
|
||||||
_tableRule = old => name;
|
_tableRule = old => name;
|
||||||
@ -835,7 +835,7 @@ namespace FreeSql.Internal.CommonProvider
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
if (_table.AsTableImpl != null)
|
if (_table.AsTableImpl != null)
|
||||||
{
|
{
|
||||||
var names = _table.AsTableImpl.GetTableNamesBySqlWhere(newwhere.ToString(), _params, _table, _commonUtils);
|
var names = _table.AsTableImpl.GetTableNamesBySqlWhere(newwhere.ToString(), _params, new SelectTableInfo { Table = _table }, _commonUtils);
|
||||||
foreach (var name in names)
|
foreach (var name in names)
|
||||||
{
|
{
|
||||||
_tableRule = old => name;
|
_tableRule = old => name;
|
||||||
|
@ -34,7 +34,7 @@ namespace FreeSql.ClickHouse
|
|||||||
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(operandExp)} as Int8)";
|
case "System.Byte": return $"cast({getExp(operandExp)} as Int8)";
|
||||||
case "System.Char": return $"substr(cast({getExp(operandExp)} as String), 1, 1)";
|
case "System.Char": return $"substr(cast({getExp(operandExp)} as String), 1, 1)";
|
||||||
case "System.DateTime": return $"cast({getExp(operandExp)} as DateTime)";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"cast({getExp(operandExp)} as DateTime)";
|
||||||
case "System.Decimal": return $"cast({getExp(operandExp)} as Decimal128(19))";
|
case "System.Decimal": return $"cast({getExp(operandExp)} as Decimal128(19))";
|
||||||
case "System.Double": return $"cast({getExp(operandExp)} as Float64)";
|
case "System.Double": return $"cast({getExp(operandExp)} as Float64)";
|
||||||
case "System.Int16": return $"cast({getExp(operandExp)} as Int16)";
|
case "System.Int16": return $"cast({getExp(operandExp)} as Int16)";
|
||||||
@ -62,7 +62,7 @@ namespace FreeSql.ClickHouse
|
|||||||
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as Int8)";
|
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as Int8)";
|
||||||
case "System.Char": return $"substr(cast({getExp(callExp.Arguments[0])} as String), 1, 1)";
|
case "System.Char": return $"substr(cast({getExp(callExp.Arguments[0])} as String), 1, 1)";
|
||||||
case "System.DateTime": return $"cast({getExp(callExp.Arguments[0])} as DateTime)";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"cast({getExp(callExp.Arguments[0])} as DateTime)";
|
||||||
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as Decimal128(19))";
|
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as Decimal128(19))";
|
||||||
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as Float64)";
|
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as Float64)";
|
||||||
case "System.Int16": return $"cast({getExp(callExp.Arguments[0])} as Int16)";
|
case "System.Int16": return $"cast({getExp(callExp.Arguments[0])} as Int16)";
|
||||||
@ -419,10 +419,10 @@ namespace FreeSql.ClickHouse
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"cast({getExp(exp.Arguments[0])} as DateTime)";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as DateTime)";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"cast({getExp(exp.Arguments[0])} as DateTime)";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as DateTime)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -555,7 +555,7 @@ namespace FreeSql.ClickHouse
|
|||||||
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
||||||
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as Int8)";
|
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as Int8)";
|
||||||
case "ToChar": return $"substr(cast({getExp(exp.Arguments[0])} as String), 1, 1)";
|
case "ToChar": return $"substr(cast({getExp(exp.Arguments[0])} as String), 1, 1)";
|
||||||
case "ToDateTime": return $"cast({getExp(exp.Arguments[0])} as DateTime)";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as DateTime)";
|
||||||
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as Decimal128(19))";
|
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as Decimal128(19))";
|
||||||
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as Float64)";
|
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as Float64)";
|
||||||
case "ToInt16":
|
case "ToInt16":
|
||||||
|
@ -32,7 +32,7 @@ namespace FreeSql.Firebird
|
|||||||
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(operandExp)} as smallint)";
|
case "System.Byte": return $"cast({getExp(operandExp)} as smallint)";
|
||||||
case "System.Char": return $"substring(cast({getExp(operandExp)} as varchar(10)) from 1 for 1)";
|
case "System.Char": return $"substring(cast({getExp(operandExp)} as varchar(10)) from 1 for 1)";
|
||||||
case "System.DateTime": return $"cast({getExp(operandExp)} as timestamp)";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"cast({getExp(operandExp)} as timestamp)";
|
||||||
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(18,6))";
|
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(18,6))";
|
||||||
case "System.Double": return $"cast({getExp(operandExp)} as decimal(18,10))";
|
case "System.Double": return $"cast({getExp(operandExp)} as decimal(18,10))";
|
||||||
case "System.Int16": return $"cast({getExp(operandExp)} as smallint)";
|
case "System.Int16": return $"cast({getExp(operandExp)} as smallint)";
|
||||||
@ -60,7 +60,7 @@ namespace FreeSql.Firebird
|
|||||||
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as smallint)";
|
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as smallint)";
|
||||||
case "System.Char": return $"substring(cast({getExp(callExp.Arguments[0])} as varchar(10)) from 1 for 1)";
|
case "System.Char": return $"substring(cast({getExp(callExp.Arguments[0])} as varchar(10)) from 1 for 1)";
|
||||||
case "System.DateTime": return $"cast({getExp(callExp.Arguments[0])} as timestamp)";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"cast({getExp(callExp.Arguments[0])} as timestamp)";
|
||||||
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(18,6))";
|
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(18,6))";
|
||||||
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(18,10))";
|
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(18,10))";
|
||||||
case "System.Int16": return $"cast({getExp(callExp.Arguments[0])} as smallint)";
|
case "System.Int16": return $"cast({getExp(callExp.Arguments[0])} as smallint)";
|
||||||
@ -389,10 +389,10 @@ namespace FreeSql.Firebird
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"mod({isLeapYearArgs1},4)=0 AND mod({isLeapYearArgs1},100)<>0 OR mod({isLeapYearArgs1},400)=0";
|
return $"mod({isLeapYearArgs1},4)=0 AND mod({isLeapYearArgs1},100)<>0 OR mod({isLeapYearArgs1},400)=0";
|
||||||
|
|
||||||
case "Parse": return $"cast({getExp(exp.Arguments[0])} as timestamp)";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as timestamp)";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"cast({getExp(exp.Arguments[0])} as timestamp)";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as timestamp)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -504,7 +504,7 @@ namespace FreeSql.Firebird
|
|||||||
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
||||||
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as smallint)";
|
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as smallint)";
|
||||||
case "ToChar": return $"substring(cast({getExp(exp.Arguments[0])} as varchar(10)) from 1 for 1)";
|
case "ToChar": return $"substring(cast({getExp(exp.Arguments[0])} as varchar(10)) from 1 for 1)";
|
||||||
case "ToDateTime": return $"cast({getExp(exp.Arguments[0])} as timestamp)";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as timestamp)";
|
||||||
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(18,6))";
|
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(18,6))";
|
||||||
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(18,10))";
|
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(18,10))";
|
||||||
case "ToInt16": return $"cast({getExp(exp.Arguments[0])} as smallint)";
|
case "ToInt16": return $"cast({getExp(exp.Arguments[0])} as smallint)";
|
||||||
|
@ -35,7 +35,7 @@ namespace FreeSql.KingbaseES
|
|||||||
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(operandExp)})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"({getExp(operandExp)})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
||||||
case "System.Double": return $"({getExp(operandExp)})::float8";
|
case "System.Double": return $"({getExp(operandExp)})::float8";
|
||||||
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
||||||
@ -63,7 +63,7 @@ namespace FreeSql.KingbaseES
|
|||||||
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(callExp.Arguments[0])})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"({getExp(callExp.Arguments[0])})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
||||||
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
||||||
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
@ -468,10 +468,10 @@ namespace FreeSql.KingbaseES
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})::int8%4=0 AND ({isLeapYearArgs1})::int8%100<>0 OR ({isLeapYearArgs1})::int8%400=0)";
|
return $"(({isLeapYearArgs1})::int8%4=0 AND ({isLeapYearArgs1})::int8%100<>0 OR ({isLeapYearArgs1})::int8%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -605,7 +605,7 @@ namespace FreeSql.KingbaseES
|
|||||||
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
||||||
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
||||||
case "ToDateTime": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
||||||
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
||||||
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
|
@ -34,7 +34,7 @@ namespace FreeSql.MySql
|
|||||||
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(operandExp)} as unsigned)";
|
case "System.Byte": return $"cast({getExp(operandExp)} as unsigned)";
|
||||||
case "System.Char": return $"substr(cast({getExp(operandExp)} as char), 1, 1)";
|
case "System.Char": return $"substr(cast({getExp(operandExp)} as char), 1, 1)";
|
||||||
case "System.DateTime": return $"cast({getExp(operandExp)} as datetime)";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"cast({getExp(operandExp)} as datetime)";
|
||||||
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(operandExp)} as decimal(32,16))";
|
case "System.Double": return $"cast({getExp(operandExp)} as decimal(32,16))";
|
||||||
case "System.Int16":
|
case "System.Int16":
|
||||||
@ -62,7 +62,7 @@ namespace FreeSql.MySql
|
|||||||
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as unsigned)";
|
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as unsigned)";
|
||||||
case "System.Char": return $"substr(cast({getExp(callExp.Arguments[0])} as char), 1, 1)";
|
case "System.Char": return $"substr(cast({getExp(callExp.Arguments[0])} as char), 1, 1)";
|
||||||
case "System.DateTime": return $"cast({getExp(callExp.Arguments[0])} as datetime)";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"cast({getExp(callExp.Arguments[0])} as datetime)";
|
||||||
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(32,16))";
|
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(32,16))";
|
||||||
case "System.Int16":
|
case "System.Int16":
|
||||||
@ -401,10 +401,10 @@ namespace FreeSql.MySql
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -537,7 +537,7 @@ namespace FreeSql.MySql
|
|||||||
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
||||||
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as unsigned)";
|
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as unsigned)";
|
||||||
case "ToChar": return $"substr(cast({getExp(exp.Arguments[0])} as char), 1, 1)";
|
case "ToChar": return $"substr(cast({getExp(exp.Arguments[0])} as char), 1, 1)";
|
||||||
case "ToDateTime": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
||||||
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(32,16))";
|
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(32,16))";
|
||||||
case "ToInt16":
|
case "ToInt16":
|
||||||
|
@ -35,7 +35,7 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(operandExp)})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"({getExp(operandExp)})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
||||||
case "System.Double": return $"({getExp(operandExp)})::float8";
|
case "System.Double": return $"({getExp(operandExp)})::float8";
|
||||||
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
||||||
@ -63,7 +63,7 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(callExp.Arguments[0])})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"({getExp(callExp.Arguments[0])})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
||||||
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
||||||
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
@ -468,10 +468,10 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})::int8%4=0 AND ({isLeapYearArgs1})::int8%100<>0 OR ({isLeapYearArgs1})::int8%400=0)";
|
return $"(({isLeapYearArgs1})::int8%4=0 AND ({isLeapYearArgs1})::int8%100<>0 OR ({isLeapYearArgs1})::int8%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -605,7 +605,7 @@ namespace FreeSql.Odbc.KingbaseES
|
|||||||
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
||||||
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
||||||
case "ToDateTime": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
||||||
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
||||||
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
|
@ -32,7 +32,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(operandExp)} as unsigned)";
|
case "System.Byte": return $"cast({getExp(operandExp)} as unsigned)";
|
||||||
case "System.Char": return $"substr(cast({getExp(operandExp)} as char), 1, 1)";
|
case "System.Char": return $"substr(cast({getExp(operandExp)} as char), 1, 1)";
|
||||||
case "System.DateTime": return $"cast({getExp(operandExp)} as datetime)";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"cast({getExp(operandExp)} as datetime)";
|
||||||
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(operandExp)} as decimal(32,16))";
|
case "System.Double": return $"cast({getExp(operandExp)} as decimal(32,16))";
|
||||||
case "System.Int16":
|
case "System.Int16":
|
||||||
@ -60,7 +60,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as unsigned)";
|
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as unsigned)";
|
||||||
case "System.Char": return $"substr(cast({getExp(callExp.Arguments[0])} as char), 1, 1)";
|
case "System.Char": return $"substr(cast({getExp(callExp.Arguments[0])} as char), 1, 1)";
|
||||||
case "System.DateTime": return $"cast({getExp(callExp.Arguments[0])} as datetime)";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"cast({getExp(callExp.Arguments[0])} as datetime)";
|
||||||
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(32,16))";
|
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(32,16))";
|
||||||
case "System.Int16":
|
case "System.Int16":
|
||||||
@ -399,10 +399,10 @@ namespace FreeSql.Odbc.MySql
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -535,7 +535,7 @@ namespace FreeSql.Odbc.MySql
|
|||||||
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
||||||
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as unsigned)";
|
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as unsigned)";
|
||||||
case "ToChar": return $"substr(cast({getExp(exp.Arguments[0])} as char), 1, 1)";
|
case "ToChar": return $"substr(cast({getExp(exp.Arguments[0])} as char), 1, 1)";
|
||||||
case "ToDateTime": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
||||||
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(32,16))";
|
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(32,16))";
|
||||||
case "ToInt16":
|
case "ToInt16":
|
||||||
|
@ -35,7 +35,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(operandExp)})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"({getExp(operandExp)})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
||||||
case "System.Double": return $"({getExp(operandExp)})::float8";
|
case "System.Double": return $"({getExp(operandExp)})::float8";
|
||||||
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
||||||
@ -63,7 +63,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(callExp.Arguments[0])})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"({getExp(callExp.Arguments[0])})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
||||||
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
||||||
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
@ -493,10 +493,10 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})::int8%4=0 AND ({isLeapYearArgs1})::int8%100<>0 OR ({isLeapYearArgs1})::int8%400=0)";
|
return $"(({isLeapYearArgs1})::int8%4=0 AND ({isLeapYearArgs1})::int8%100<>0 OR ({isLeapYearArgs1})::int8%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -630,7 +630,7 @@ namespace FreeSql.Odbc.PostgreSQL
|
|||||||
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
||||||
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
||||||
case "ToDateTime": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
||||||
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
||||||
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
|
@ -32,7 +32,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
case "System.Boolean": return $"(cast({getExp(operandExp)} as varchar) not in ('0','false'))";
|
case "System.Boolean": return $"(cast({getExp(operandExp)} as varchar) not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(operandExp)} as tinyint)";
|
case "System.Byte": return $"cast({getExp(operandExp)} as tinyint)";
|
||||||
case "System.Char": return $"substring(cast({getExp(operandExp)} as nvarchar),1,1)";
|
case "System.Char": return $"substring(cast({getExp(operandExp)} as nvarchar),1,1)";
|
||||||
case "System.DateTime": return $"cast({getExp(operandExp)} as datetime)";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"cast({getExp(operandExp)} as datetime)";
|
||||||
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(operandExp)} as decimal(32,16))";
|
case "System.Double": return $"cast({getExp(operandExp)} as decimal(32,16))";
|
||||||
case "System.Int16": return $"cast({getExp(operandExp)} as smallint)";
|
case "System.Int16": return $"cast({getExp(operandExp)} as smallint)";
|
||||||
@ -63,7 +63,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
case "System.Boolean": return $"(cast({getExp(callExp.Arguments[0])} as varchar) not in ('0','false'))";
|
case "System.Boolean": return $"(cast({getExp(callExp.Arguments[0])} as varchar) not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as tinyint)";
|
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as tinyint)";
|
||||||
case "System.Char": return $"substring(cast({getExp(callExp.Arguments[0])} as nvarchar),1,1)";
|
case "System.Char": return $"substring(cast({getExp(callExp.Arguments[0])} as nvarchar),1,1)";
|
||||||
case "System.DateTime": return $"cast({getExp(callExp.Arguments[0])} as datetime)";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"cast({getExp(callExp.Arguments[0])} as datetime)";
|
||||||
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(32,16))";
|
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(32,16))";
|
||||||
case "System.Int16": return $"cast({getExp(callExp.Arguments[0])} as smallint)";
|
case "System.Int16": return $"cast({getExp(callExp.Arguments[0])} as smallint)";
|
||||||
@ -400,10 +400,10 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -526,7 +526,7 @@ namespace FreeSql.Odbc.SqlServer
|
|||||||
case "ToBoolean": return $"(cast({getExp(exp.Arguments[0])} as varchar) not in ('0','false'))";
|
case "ToBoolean": return $"(cast({getExp(exp.Arguments[0])} as varchar) not in ('0','false'))";
|
||||||
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as tinyint)";
|
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as tinyint)";
|
||||||
case "ToChar": return $"substring(cast({getExp(exp.Arguments[0])} as nvarchar),1,1)";
|
case "ToChar": return $"substring(cast({getExp(exp.Arguments[0])} as nvarchar),1,1)";
|
||||||
case "ToDateTime": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
||||||
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(32,16))";
|
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(32,16))";
|
||||||
case "ToInt16": return $"cast({getExp(exp.Arguments[0])} as smallint)";
|
case "ToInt16": return $"cast({getExp(exp.Arguments[0])} as smallint)";
|
||||||
|
@ -36,7 +36,7 @@ namespace FreeSql.PostgreSQL
|
|||||||
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(operandExp)})::varchar not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(operandExp)})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"({getExp(operandExp)})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
||||||
case "System.Double": return $"({getExp(operandExp)})::float8";
|
case "System.Double": return $"({getExp(operandExp)})::float8";
|
||||||
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
||||||
@ -64,7 +64,7 @@ namespace FreeSql.PostgreSQL
|
|||||||
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(callExp.Arguments[0])})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"({getExp(callExp.Arguments[0])})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
||||||
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
||||||
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
@ -524,10 +524,10 @@ namespace FreeSql.PostgreSQL
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})::int8%4=0 AND ({isLeapYearArgs1})::int8%100<>0 OR ({isLeapYearArgs1})::int8%400=0)";
|
return $"(({isLeapYearArgs1})::int8%4=0 AND ({isLeapYearArgs1})::int8%100<>0 OR ({isLeapYearArgs1})::int8%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -661,7 +661,7 @@ namespace FreeSql.PostgreSQL
|
|||||||
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::varchar not in ('0','false','f','no'))";
|
||||||
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
||||||
case "ToDateTime": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
||||||
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
||||||
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
|
@ -35,7 +35,7 @@ namespace FreeSql.ShenTong
|
|||||||
case "System.Boolean": return $"(({getExp(operandExp)})::text not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(operandExp)})::text not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
case "System.Byte": return $"({getExp(operandExp)})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(operandExp)})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(operandExp)})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"({getExp(operandExp)})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
case "System.Decimal": return $"({getExp(operandExp)})::numeric";
|
||||||
case "System.Double": return $"({getExp(operandExp)})::float8";
|
case "System.Double": return $"({getExp(operandExp)})::float8";
|
||||||
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
case "System.Int16": return $"({getExp(operandExp)})::int2";
|
||||||
@ -63,7 +63,7 @@ namespace FreeSql.ShenTong
|
|||||||
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::text not in ('0','false','f','no'))";
|
case "System.Boolean": return $"(({getExp(callExp.Arguments[0])})::text not in ('0','false','f','no'))";
|
||||||
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Byte": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
case "System.Char": return $"substr(({getExp(callExp.Arguments[0])})::char, 1, 1)";
|
||||||
case "System.DateTime": return $"({getExp(callExp.Arguments[0])})::timestamp";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"({getExp(callExp.Arguments[0])})::timestamp";
|
||||||
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
case "System.Decimal": return $"({getExp(callExp.Arguments[0])})::numeric";
|
||||||
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
case "System.Double": return $"({getExp(callExp.Arguments[0])})::float8";
|
||||||
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
case "System.Int16": return $"({getExp(callExp.Arguments[0])})::int2";
|
||||||
@ -448,10 +448,10 @@ namespace FreeSql.ShenTong
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -585,7 +585,7 @@ namespace FreeSql.ShenTong
|
|||||||
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::text not in ('0','false','f','no'))";
|
case "ToBoolean": return $"(({getExp(exp.Arguments[0])})::text not in ('0','false','f','no'))";
|
||||||
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToByte": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
case "ToChar": return $"substr(({getExp(exp.Arguments[0])})::char, 1, 1)";
|
||||||
case "ToDateTime": return $"({getExp(exp.Arguments[0])})::timestamp";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"({getExp(exp.Arguments[0])})::timestamp";
|
||||||
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
case "ToDecimal": return $"({getExp(exp.Arguments[0])})::numeric";
|
||||||
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
case "ToDouble": return $"({getExp(exp.Arguments[0])})::float8";
|
||||||
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
case "ToInt16": return $"({getExp(exp.Arguments[0])})::int2";
|
||||||
|
@ -32,7 +32,7 @@ namespace FreeSql.SqlServer
|
|||||||
case "System.Boolean": return $"(cast({getExp(operandExp)} as varchar) not in ('0','false'))";
|
case "System.Boolean": return $"(cast({getExp(operandExp)} as varchar) not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(operandExp)} as tinyint)";
|
case "System.Byte": return $"cast({getExp(operandExp)} as tinyint)";
|
||||||
case "System.Char": return $"substring(cast({getExp(operandExp)} as nvarchar),1,1)";
|
case "System.Char": return $"substring(cast({getExp(operandExp)} as nvarchar),1,1)";
|
||||||
case "System.DateTime": return $"cast({getExp(operandExp)} as datetime)";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"cast({getExp(operandExp)} as datetime)";
|
||||||
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(operandExp)} as decimal(32,16))";
|
case "System.Double": return $"cast({getExp(operandExp)} as decimal(32,16))";
|
||||||
case "System.Int16": return $"cast({getExp(operandExp)} as smallint)";
|
case "System.Int16": return $"cast({getExp(operandExp)} as smallint)";
|
||||||
@ -62,7 +62,7 @@ namespace FreeSql.SqlServer
|
|||||||
case "System.Boolean": return $"(cast({getExp(callExp.Arguments[0])} as varchar) not in ('0','false'))";
|
case "System.Boolean": return $"(cast({getExp(callExp.Arguments[0])} as varchar) not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as tinyint)";
|
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as tinyint)";
|
||||||
case "System.Char": return $"substring(cast({getExp(callExp.Arguments[0])} as nvarchar),1,1)";
|
case "System.Char": return $"substring(cast({getExp(callExp.Arguments[0])} as nvarchar),1,1)";
|
||||||
case "System.DateTime": return $"cast({getExp(callExp.Arguments[0])} as datetime)";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"cast({getExp(callExp.Arguments[0])} as datetime)";
|
||||||
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(32,16))";
|
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as decimal(32,16))";
|
||||||
case "System.Int16": return $"cast({getExp(callExp.Arguments[0])} as smallint)";
|
case "System.Int16": return $"cast({getExp(callExp.Arguments[0])} as smallint)";
|
||||||
@ -400,10 +400,10 @@ namespace FreeSql.SqlServer
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -524,7 +524,7 @@ namespace FreeSql.SqlServer
|
|||||||
case "ToBoolean": return $"(cast({getExp(exp.Arguments[0])} as varchar) not in ('0','false'))";
|
case "ToBoolean": return $"(cast({getExp(exp.Arguments[0])} as varchar) not in ('0','false'))";
|
||||||
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as tinyint)";
|
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as tinyint)";
|
||||||
case "ToChar": return $"substring(cast({getExp(exp.Arguments[0])} as nvarchar),1,1)";
|
case "ToChar": return $"substring(cast({getExp(exp.Arguments[0])} as nvarchar),1,1)";
|
||||||
case "ToDateTime": return $"cast({getExp(exp.Arguments[0])} as datetime)";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"cast({getExp(exp.Arguments[0])} as datetime)";
|
||||||
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
||||||
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(32,16))";
|
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as decimal(32,16))";
|
||||||
case "ToInt16": return $"cast({getExp(exp.Arguments[0])} as smallint)";
|
case "ToInt16": return $"cast({getExp(exp.Arguments[0])} as smallint)";
|
||||||
|
@ -32,7 +32,7 @@ namespace FreeSql.Sqlite
|
|||||||
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(operandExp)} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(operandExp)} as int2)";
|
case "System.Byte": return $"cast({getExp(operandExp)} as int2)";
|
||||||
case "System.Char": return $"substr(cast({getExp(operandExp)} as character), 1, 1)";
|
case "System.Char": return $"substr(cast({getExp(operandExp)} as character), 1, 1)";
|
||||||
case "System.DateTime": return $"datetime({getExp(operandExp)})";
|
case "System.DateTime": return ExpressionConstDateTime(operandExp) ?? $"datetime({getExp(operandExp)})";
|
||||||
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(operandExp)} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(operandExp)} as double)";
|
case "System.Double": return $"cast({getExp(operandExp)} as double)";
|
||||||
case "System.Int16":
|
case "System.Int16":
|
||||||
@ -60,7 +60,7 @@ namespace FreeSql.Sqlite
|
|||||||
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
case "System.Boolean": return $"({getExp(callExp.Arguments[0])} not in ('0','false'))";
|
||||||
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as int2)";
|
case "System.Byte": return $"cast({getExp(callExp.Arguments[0])} as int2)";
|
||||||
case "System.Char": return $"substr(cast({getExp(callExp.Arguments[0])} as character), 1, 1)";
|
case "System.Char": return $"substr(cast({getExp(callExp.Arguments[0])} as character), 1, 1)";
|
||||||
case "System.DateTime": return $"datetime({getExp(callExp.Arguments[0])})";
|
case "System.DateTime": return ExpressionConstDateTime(callExp.Arguments[0]) ?? $"datetime({getExp(callExp.Arguments[0])})";
|
||||||
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
case "System.Decimal": return $"cast({getExp(callExp.Arguments[0])} as decimal(36,18))";
|
||||||
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as double)";
|
case "System.Double": return $"cast({getExp(callExp.Arguments[0])} as double)";
|
||||||
case "System.Int16":
|
case "System.Int16":
|
||||||
@ -415,10 +415,10 @@ namespace FreeSql.Sqlite
|
|||||||
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
var isLeapYearArgs1 = getExp(exp.Arguments[0]);
|
||||||
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
return $"(({isLeapYearArgs1})%4=0 AND ({isLeapYearArgs1})%100<>0 OR ({isLeapYearArgs1})%400=0)";
|
||||||
|
|
||||||
case "Parse": return $"datetime({getExp(exp.Arguments[0])})";
|
case "Parse": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"datetime({getExp(exp.Arguments[0])})";
|
||||||
case "ParseExact":
|
case "ParseExact":
|
||||||
case "TryParse":
|
case "TryParse":
|
||||||
case "TryParseExact": return $"datetime({getExp(exp.Arguments[0])})";
|
case "TryParseExact": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"datetime({getExp(exp.Arguments[0])})";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -551,7 +551,7 @@ namespace FreeSql.Sqlite
|
|||||||
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
|
||||||
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as int2)";
|
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as int2)";
|
||||||
case "ToChar": return $"substr(cast({getExp(exp.Arguments[0])} as character), 1, 1)";
|
case "ToChar": return $"substr(cast({getExp(exp.Arguments[0])} as character), 1, 1)";
|
||||||
case "ToDateTime": return $"datetime({getExp(exp.Arguments[0])})";
|
case "ToDateTime": return ExpressionConstDateTime(exp.Arguments[0]) ?? $"datetime({getExp(exp.Arguments[0])})";
|
||||||
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
case "ToDecimal": return $"cast({getExp(exp.Arguments[0])} as decimal(36,18))";
|
||||||
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as double)";
|
case "ToDouble": return $"cast({getExp(exp.Arguments[0])} as double)";
|
||||||
case "ToInt16":
|
case "ToInt16":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user