public static Int32Parameter FromDateTimeParameter(DateTimeParameter timestamp, TimeCache time) { if (timestamp == null) { return(null); } var res = new Int32Parameter(); if (timestamp.Eq != null) { res.Eq = time.FindLevel((DateTime)timestamp.Eq, SearchMode.Exact); } if (timestamp.Ne != null) { res.Ne = time.FindLevel((DateTime)timestamp.Ne, SearchMode.Exact); } if (timestamp.Gt != null) { res.Gt = time.FindLevel((DateTime)timestamp.Gt, SearchMode.ExactOrLower); } if (timestamp.Ge != null) { res.Ge = time.FindLevel((DateTime)timestamp.Ge, SearchMode.ExactOrLower); } return(res); }
public SqlBuilder Filter(string column, DateTimeParameter value, Func <string, string> map = null) { if (value == null) { return(this); } if (value.Eq != null) { AppendFilter($@"""{column}"" = @p{Counter}"); Params.Add($"p{Counter++}", value.Eq); } if (value.Ne != null) { AppendFilter($@"""{column}"" != @p{Counter}"); Params.Add($"p{Counter++}", value.Ne); } if (value.Gt != null) { AppendFilter($@"""{column}"" > @p{Counter}"); Params.Add($"p{Counter++}", value.Gt); } if (value.Ge != null) { AppendFilter($@"""{column}"" >= @p{Counter}"); Params.Add($"p{Counter++}", value.Ge); } if (value.Lt != null) { AppendFilter($@"""{column}"" < @p{Counter}"); Params.Add($"p{Counter++}", value.Lt); } if (value.Le != null) { AppendFilter($@"""{column}"" <= @p{Counter}"); Params.Add($"p{Counter++}", value.Le); } if (value.In != null) { AppendFilter($@"""{column}"" = ANY (@p{Counter})"); Params.Add($"p{Counter++}", value.In); } if (value.Ni != null) { AppendFilter($@"NOT (""{column}"" = ANY (@p{Counter}))"); Params.Add($"p{Counter++}", value.Ni); } return(this); }
public SqlBuilder Filter(string column, DateTimeParameter value, Func <string, string> map = null) { if (value == null) { return(this); } if (value.Eq != null) { AppendFilter($@"""{column}"" = {Param(value.Eq)}"); } if (value.Ne != null) { AppendFilter($@"""{column}"" != {Param(value.Ne)}"); } if (value.Gt != null) { AppendFilter($@"""{column}"" > {Param(value.Gt)}"); } if (value.Ge != null) { AppendFilter($@"""{column}"" >= {Param(value.Ge)}"); } if (value.Lt != null) { AppendFilter($@"""{column}"" < {Param(value.Lt)}"); } if (value.Le != null) { AppendFilter($@"""{column}"" <= {Param(value.Le)}"); } if (value.In != null) { AppendFilter($@"""{column}"" = ANY ({Param(value.In)})"); } if (value.Ni != null) { AppendFilter($@"NOT (""{column}"" = ANY ({Param(value.Ni)}))"); } return(this); }