コード例 #1
0
        public QueryTree Reorder()
        {
            QueryTree PostProcess = new QueryTree();

            while (currentToken < Subject.QueryTokens.Count && Peak.Type != TokenType.SemiColon)
            {
                if (Parsers.ContainsKey(Subject.QueryTokens[currentToken].Type))
                {
                    PostProcess.Root = Parsers[Subject.QueryTokens[currentToken].Type]();
                }
            }
            return(PostProcess);
        }
コード例 #2
0
        public QueryExecutioner(QueryTree Q_Entry, Database DB, TouchTable t)
        {
            Touch    = t;
            Query    = Q_Entry;
            database = DB;
            Execs    = new Dictionary <TokenType, Executive>()
            {
                { TokenType.SELECT_cmd, Select },
                { TokenType.INSERT_cmd, Insert },
                { TokenType.UPDATE_cmd, Update },
                { TokenType.DELETE_cmd, Delete },
                { TokenType.CREATE_cmd, Create },
                { TokenType.ALTER_cmd, Alter }
            };

            Joiners = new Dictionary <TokenType, Executive>()
            {
                { TokenType.INNER_KW, InnerJoin },
                { TokenType.OUTER_KW, OuterJoin },
                { TokenType.LEFT_KW, LeftJoin },
                { TokenType.RIGHT_KW, RightJoin },
            };

            Alters = new Dictionary <TokenType, Executive>()
            {
                { TokenType.ADD_KW, AlterAdd },
                { TokenType.DROP_cmd, AlterDrop },
                { TokenType.ALTER_cmd, AlterModify },
                { TokenType.RENAME_cmd, AltereName }
            };

            Conditionals = new Dictionary <TokenType, Executive>()
            {
                { TokenType.WHERE_KW, Where }
            };
        }