示例#1
0
        public virtual void testRemoveSetClauseInUpdate()
        {
            parser.sqltext = "UPDATE BLA SET A=2, B=3 WHERE X=5";
            Assert.IsTrue(parser.parse() == 0);

            TUpdateSqlStatement updateSqlStatement = (TUpdateSqlStatement)parser.sqlstatements.get(0);
            TResultColumnList   setClauses         = updateSqlStatement.ResultColumnList;

            setClauses.removeElementAt(0);
            // System.out.println(scriptGenerator.generateScript(updateSqlStatement, true));
            Assert.IsTrue(testScriptGenerator.verifyScript(EDbVendor.dbvoracle
                                                           , updateSqlStatement.ToScript()
                                                           , "UPDATE bla\n" +
                                                           "SET    b=3\n" +
                                                           "WHERE  x = 5"
                                                           ));
        }
示例#2
0
        public virtual void testRemoveResultColumnInSelectList()
        {
            parser.sqltext = "SELECT A as A_Alias, B AS B_Alias FROM TABLE_X";
            Assert.IsTrue(parser.parse() == 0);
            TSelectSqlStatement select  = (TSelectSqlStatement)parser.sqlstatements.get(0);
            TResultColumnList   columns = select.ResultColumnList;

            columns.removeElementAt(1);
            TResultColumn resultColumn = new TResultColumn();

            resultColumn.Expr = parser.parseExpression("x");
            columns.addResultColumn(resultColumn);
            // System.out.println(scriptGenerator.generateScript(select, true));
            Assert.IsTrue(testScriptGenerator.verifyScript(EDbVendor.dbvoracle
                                                           , select.ToScript()
                                                           , "SELECT a AS a_alias,\n" +
                                                           "       x\n" +
                                                           "FROM   table_x"
                                                           ));
        }