Example #1
0
        private object HandleConditionalClauseNode(IClauseNode node, Context parameter)
        {
            var context = new Context(parameter);

            foreach (var child in node.Children)
            {
                child.Accept(this, context);
            }

            if (context.IsAvailable)
            {
                node.WordNode.Accept(this, parameter);
                parameter.IsAvailable = true;
                parameter.AppendRawSql(context.GetRawSql());
                parameter.AppendFormattedSql(context.GetFormattedSql());
                parameter.AddAllParameters(context.SqlParameters);
            }
            else
            {
                var fragment = context.GetRawSql();
                if (StartWithClauseKeyword(fragment))
                {
                    parameter.IsAvailable = true;
                    parameter.AppendRawSql(context.GetRawSql());
                    parameter.AppendFormattedSql(context.GetFormattedSql());
                    parameter.AddAllParameters(context.SqlParameters);
                }
            }

            return(null);
        }
Example #2
0
        public override object Visit(IClauseNode clauseNode)
        {
            if (Enum.IsDefined(typeof(ClauseType), clauseNode.Operation))
            {
                return(base.Visit(clauseNode));
            }
            int operation = Convert.ToInt32(clauseNode.Operation);

            if (operation == ClauseTypeEnumHelper.FullText)
            {
                return(new FunctionOperator(FullTextContainsFunction.FunctionName, clauseNode.FirstOperand, clauseNode.AdditionalOperands[0]));
            }
            throw new NotImplementedException();
        }
Example #3
0
 public override object Visit(IClauseNode clauseNode) {
     if (Enum.IsDefined(typeof(ClauseType), clauseNode.Operation))
         return base.Visit(clauseNode);
     int operation = Convert.ToInt32(clauseNode.Operation);
     if (operation == ClauseTypeEnumHelper.FullText)
         return new FunctionOperator(FullTextContainsFunction.FunctionName, clauseNode.FirstOperand, clauseNode.AdditionalOperands[0]);
     throw new NotImplementedException();
 }