Example #1
0
        public List <SetStatement> ParseSetStatement(SetStatementContext node)
        {
            List <SetStatement> statements = new List <SetStatement>();

            foreach (var child in node.children)
            {
                if (child is VariableClauseContext variable)
                {
                    SetStatement statement = new SetStatement();

                    statement.Key = new TokenInfo(variable);

                    statements.Add(statement);
                }
                else if (child is PredicateExpressionContext exp)
                {
                    statements.Last().Value = this.ParseToken(exp);
                }
            }

            return(statements);
        }
        private void ParseSetStatement(SetStatementContext node)
        {
            foreach (var child in node.children)
            {
                if (child is VariableClauseContext variable)
                {
                    string text = variable.GetText();

                    this.Write(text, 1);
                }
                else if (child is PredicateExpressionContext exp)
                {
                    this.ParsePredicateExpression(exp);
                }
                else if (child is TerminalNodeImpl terminalNode)
                {
                    string text = child.GetText();

                    this.Write(text, terminalNode.Symbol.Type == MySqlParser.SET ? this.indent: 0);
                }
            }
        }