コード例 #1
0
        public override object VisitSearch_expression([NotNull] KoraliumParser.Search_expressionContext context)
        {
            SearchExpression searchExpression = new SearchExpression();

            if (context.wildcard != null)
            {
                searchExpression.AllColumns = true;
            }
            else
            {
                var columnNodes = context.column_reference();

                if (columnNodes == null)
                {
                    throw new SqlParserException("Missing columns in CONTAINS");
                }

                foreach (var columnNode in columnNodes)
                {
                    var columnReference = Visit(columnNode) as ColumnReference;

                    if (columnReference == null)
                    {
                        throw new SqlParserException("parameter in CONTAINS could not be resolved to a column");
                    }

                    searchExpression.Columns.Add(columnReference);
                }
            }


            var scalarExpressionNode = context.scalar_expression();

            if (scalarExpressionNode == null)
            {
                throw new SqlParserException("Could not find any search term in CONTAINS");
            }

            var scalarExpression = Visit(scalarExpressionNode) as ScalarExpression;

            if (scalarExpression == null)
            {
                throw new SqlParserException("Could not parse search term in CONTAINS");
            }

            searchExpression.Value = scalarExpression;

            return(searchExpression);
        }
コード例 #2
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="KoraliumParser.search_expression"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitSearch_expression([NotNull] KoraliumParser.Search_expressionContext context)
 {
 }
コード例 #3
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="KoraliumParser.search_expression"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitSearch_expression([NotNull] KoraliumParser.Search_expressionContext context)
 {
     return(VisitChildren(context));
 }