public QueryConditionSymbol( ISymbol containingSymbol, ConditionNode declaration, DiagnosticBag diagnostics) : base(containingSymbol) { Declaration = declaration; Comparison = Declaration.Type switch { ConditionKind.EqualTo => QueryComparisonType.Equal, ConditionKind.LessThan => QueryComparisonType.LessThan, ConditionKind.GreaterThan => QueryComparisonType.GreaterThan, ConditionKind.NotEqualTo => QueryComparisonType.NotEqual, ConditionKind.AtLeast => QueryComparisonType.GreaterThanOrEqual, ConditionKind.AtMost => QueryComparisonType.LessThanOrEqual, ConditionKind.InstanceOf => throw new NotImplementedException(), // TODO consider separate class? ConditionKind.NotInstanceOf => throw new NotImplementedException(), _ => QueryComparisonType.Unknown }; if (Comparison is QueryComparisonType.Unknown) { diagnostics.Add(ErrorCode.ERR_UnknownEnumerationValue, Declaration); } Query = new QuerySymbol(containingSymbol, Declaration, diagnostics); }
/// <summary> /// Method to get the string value of a sign_e (enum) /// </summary> /// <param name="s"></param> /// <returns></returns> public static String SignToStr(QuerySymbol s) { String res = String.Empty; switch (s) { case QuerySymbol.OPEN_P: res = "("; break; case QuerySymbol.CLOSE_P: res = ")"; break; case QuerySymbol.AMPERSAND: res = "&"; break; default: break; } return(res); }
public DefaultQuerySql(string fieldName, string paramName, QuerySymbol symbol = QuerySymbol.Equal) { _fieldName = fieldName; _paramName = paramName; _symbol = symbol; }
/// <summary> /// Method to bind a sign to a parameter /// </summary> /// <param name="p">Solr Common parameter</param> /// <param name="s">Sign value</param> public void BindSign(Parameter p, QuerySymbol s) { this.values[p] += SolrQuery.SignToStr(s); }
public DefaultQuerySql(string fieldName, QuerySymbol symbol = QuerySymbol.Equal) : this(fieldName, $"p_{RandomHelper.CreateNum()}", symbol) { }