public virtual void testAddResultColumnInSelectList() { 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; TResultColumn resultColumn = new TResultColumn(); resultColumn.Expr = parser.parseExpression("d"); columns.addResultColumn(resultColumn); TAliasClause aliasClause = new TAliasClause(); aliasClause.AliasName = parser.parseObjectName("d_alias"); aliasClause.HasAs = true; resultColumn.AliasClause = aliasClause; // System.out.println(scriptGenerator.generateScript(select, true)); Assert.IsTrue(testScriptGenerator.verifyScript(EDbVendor.dbvoracle , select.ToScript() , "SELECT a AS a_alias,\n" + " b AS b_alias,\n" + " d AS d_alias\n" + "FROM table_x" )); }
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" )); }