Exemple #1
0
        private static IParseTreeVisitor <IASTNode> CreateParseTreeVisitor(ISqlParserConfiguration configuration, SqlCommandTypeEnum type)
        {
            ISqlVisitorFacade visitorFacade = configuration.CreateVisitorFacade();

            switch (type)
            {
            case SqlCommandTypeEnum.DML:
                return((IParseTreeVisitor <IASTNode>)visitorFacade.CreateDMLVisitor());

            case SqlCommandTypeEnum.DDL:
                return((IParseTreeVisitor <IASTNode>)visitorFacade.CreateDDLVisitor());

            case SqlCommandTypeEnum.TCL:
                return((IParseTreeVisitor <IASTNode>)visitorFacade.CreateTCLVisitor());

            case SqlCommandTypeEnum.DCL:
                return((IParseTreeVisitor <IASTNode>)visitorFacade.CreateDCLVisitor());

            case SqlCommandTypeEnum.DAL:
                return((IParseTreeVisitor <IASTNode>)visitorFacade.CreateDALVisitor());

            case SqlCommandTypeEnum.RL:
                return((IParseTreeVisitor <IASTNode>)visitorFacade.CreateRLVisitor());

            default:
                throw new ShardingSqlParsingException($"Can not support SQL statement type: `{type}`");
            }
        }
Exemple #2
0
 private VisitorRule(string name, SqlCommandTypeEnum sqlCommandType)
 {
     SqlCommandType = sqlCommandType;
     _name          = name;
 }