Пример #1
0
 public override void ConfigureQueryVisitor(MySqlQueryVisitor queryVisitor)
 {
     queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.IDENTIFIER, RewriteIdentifier);
     if (_replaceBacktickQuotedIdentifiers)
     {
         queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.BACK_TICK_QUOTED_ID, RewriteBacktickQuotedIdentifier);
     }
 }
        public override void ConfigureQueryVisitor(MySqlQueryVisitor queryVisitor)
        {
            //  queries that don't support a where condition
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.INSERT_SYMBOL, Disable);
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.CREATE_SYMBOL, Disable);
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.DROP_SYMBOL, Disable);

            //  queries that support a where condition
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.SELECT_SYMBOL, EnableAndResetForQuery);
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.UPDATE_SYMBOL, EnableAndResetForQuery);
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.DELETE_SYMBOL, EnableAndResetForQuery);

            //  replace the WHERE symbol if one occurs
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.WHERE_SYMBOL, WhereClauseBegin);

            //  symbols that indicate the time for a where clause has passed
            queryVisitor.AddTerminalNodeRewriter(-1, WhereClauseTerminator);             // EOF
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.HAVING_SYMBOL, WhereClauseTerminator);
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.GROUP_SYMBOL, WhereClauseTerminator);
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.ORDER_SYMBOL, WhereClauseTerminator);
            queryVisitor.AddTerminalNodeRewriter(parsers.MySQLLexer.LIMIT_SYMBOL, WhereClauseTerminator);
        }