Exemple #1
0
        public static string GetCNF(string inputText
                                    , DBMSType dbmsType
                                    , Dictionary <string, string> placeHolders = null)
        {
            var ast = MiniSqlParserAST.CreateStmts(inputText, dbmsType);

            // テスト用テーブル列
            var tableColumns = new BestCaseDictionary <IEnumerable <string> >();
            var tableT       = new string[] { "x", "y", "z" };

            tableColumns.Add("T", tableT);
            var tableU = new string[] { "x", "y", "z" };

            tableColumns.Add("U", tableU);
            var tableV = new string[] { "x1", "x2", "x3" };

            tableColumns.Add("V", tableV);

            var replacer = new ReplacePlaceHolders(placeHolders);

            ast.Accept(replacer);

            var visitor = new GetCNFVisitor(tableColumns, true);

            ast.Accept(visitor);
            return(visitor.Print(true));
        }
Exemple #2
0
        private string GetCNFOfPredicate(string predicate, DBMSType dbmsType = DBMSType.Unknown, bool ignoreCase = true)
        {
            var ast     = MiniSqlParserAST.CreatePredicate(predicate, dbmsType);
            var visitor = new GetCNFVisitor(_tableColumns, ignoreCase);

            ast.Accept(visitor);
            return(visitor.Print());
        }