Package org.apache.ws.jaxme.sqls.impl

Examples of org.apache.ws.jaxme.sqls.impl.VirtualColumn


  }

  public void testVirtualColumn() {
    Table table = getBasicTable();
    SelectStatement selectStatement = table.getSelectStatement();
    VirtualColumn col = new VirtualColumn("virtCol", Column.Type.VARCHAR);
    selectStatement.addResultColumn(col);
    col.setValue("null");
    SQLGenerator gen = sqlFactory.newSQLGenerator();
    String query = gen.getQuery(selectStatement);
    assertEquals("SELECT MyIndex, MyName, MyDate, null AS virtCol FROM MySchema.MyTable", query);
  }
View Full Code Here


    }
   
    public void testVirtualColumn() {
        Table table = getBasicTable();
        SelectStatement selectStatement = table.getSelectStatement();
        VirtualColumn col = new VirtualColumn("virtCol", Column.Type.VARCHAR);
        selectStatement.addResultColumn(col);
        col.setValue("null");
        SQLGenerator gen = getSQLGenerator();
        String query = gen.getQuery(selectStatement);
        assertEquals("SELECT MyIndex, MyName, MyDate, null AS virtCol FROM MySchema.MyTable", query);
    }
View Full Code Here

        st.setTable(dbBeteiligte);
        SelectTableReference tRef = st.getSelectTableReference();
        tRef.setAlias(pTableAlias);
        addEQ(tRef, st.getWhere(), dbBeteiligte.getColumn("aFilter"), pFilter);
        addAktenId(st.getWhere(), pAkteReference, tRef);
        VirtualColumn vc = new VirtualColumn(pColumnName, Column.Type.INTEGER);
        vc.setValue("COUNT(*)");
        st.addResultColumn(vc);

        VirtualColumn result = new VirtualColumn(pColumnName, Column.Type.INTEGER);
        result.setValue(st);
        return result;
    }
View Full Code Here

        Column aFilter = dbBeteiligte.getColumn("aFilter");

        SelectStatement st = sqlFactory.newSelectStatement();
        st.setTable(dbBeteiligte);
        SelectTableReference ref = st.getSelectTableReference();
        VirtualColumn num = new VirtualColumn("NUM", Column.Type.INTEGER);
        num.setValue("COUNT(*) OVER (PARTITION BY " + aAktenId.getName() + ")");
        st.addResultColumn(num);
        VirtualColumn minAName = new VirtualColumn("MINANAME", Column.Type.VARCHAR);
        minAName.setValue("MIN(UPPER(" + aName.getName() + ")) OVER (PARTITION BY " +
                      aAktenId.getName() + ")");
        st.addResultColumn(minAName);
        VirtualColumn minAVorname = new VirtualColumn("MINAVORNAME", Column.Type.VARCHAR);
        minAVorname.setValue("MIN(UPPER(NVL(" + aVorname.getName() +
                       ", ' '))) OVER (PARTITION BY " +
                        aAktenId.getName() + ", UPPER(" + aName.getName() +
                        "))");
        st.addResultColumn(minAVorname);
        st.addResultColumn(ref.newColumnReference(aName));
View Full Code Here

        f = pAkteReference.getStatement().createFunction("MIN");
        Function f2 = pAkteReference.getStatement().createFunction("UPPER");
        f.addPart(f2);
        f2.addPart(minTableRef.newColumnReference(dbBeteiligte.getColumn("aName")));
        VirtualColumn vc = new VirtualColumn("MIN", Column.Type.VARCHAR);
        vc.setValue(f);
        minStatement.addResultColumn(vc);

        bc.addPart(minStatement);
        return result;
    }
View Full Code Here

    }
   
    public void testVirtualColumn() {
        Table table = getBasicTable();
        SelectStatement selectStatement = table.getSelectStatement();
        VirtualColumn col = new VirtualColumn("virtCol", Column.Type.VARCHAR);
        selectStatement.addResultColumn(col);
        col.setValue("null");
        SQLGenerator gen = getSQLGenerator();
        String query = gen.getQuery(selectStatement);
        assertEquals("SELECT MyIndex, MyName, MyDate, null AS virtCol FROM MySchema.MyTable", query);
    }
View Full Code Here

        st.setTable(dbBeteiligte);
        SelectTableReference tRef = st.getSelectTableReference();
        tRef.setAlias(pTableAlias);
        addEQ(tRef, st.getWhere(), dbBeteiligte.getColumn("aFilter"), pFilter);
        addAktenId(st.getWhere(), pAkteReference, tRef);
        VirtualColumn vc = new VirtualColumn(pColumnName, Column.Type.INTEGER);
        vc.setValue("COUNT(*)");
        st.addResultColumn(vc);

        VirtualColumn result = new VirtualColumn(pColumnName, Column.Type.INTEGER);
        result.setValue(st);
        return result;
    }
View Full Code Here

        Column aFilter = dbBeteiligte.getColumn("aFilter");

        SelectStatement st = sqlFactory.newSelectStatement();
        st.setTable(dbBeteiligte);
        SelectTableReference ref = st.getSelectTableReference();
        VirtualColumn num = new VirtualColumn("NUM", Column.Type.INTEGER);
        num.setValue("COUNT(*) OVER (PARTITION BY " + aAktenId.getName() + ")");
        st.addResultColumn(num);
        VirtualColumn minAName = new VirtualColumn("MINANAME", Column.Type.VARCHAR);
        minAName.setValue("MIN(UPPER(" + aName.getName() + ")) OVER (PARTITION BY " +
                      aAktenId.getName() + ")");
        st.addResultColumn(minAName);
        VirtualColumn minAVorname = new VirtualColumn("MINAVORNAME", Column.Type.VARCHAR);
        minAVorname.setValue("MIN(UPPER(NVL(" + aVorname.getName() +
                       ", ' '))) OVER (PARTITION BY " +
                        aAktenId.getName() + ", UPPER(" + aName.getName() +
                        "))");
        st.addResultColumn(minAVorname);
        st.addResultColumn(ref.newColumnReference(aName));
View Full Code Here

        f = pAkteReference.getStatement().createFunction("MIN");
        Function f2 = pAkteReference.getStatement().createFunction("UPPER");
        f.addPart(f2);
        f2.addPart(minTableRef.newColumnReference(dbBeteiligte.getColumn("aName")));
        VirtualColumn vc = new VirtualColumn("MIN", Column.Type.VARCHAR);
        vc.setValue(f);
        minStatement.addResultColumn(vc);

        bc.addPart(minStatement);
        return result;
    }
View Full Code Here

  }

  public void testVirtualColumn() {
    Table table = getBasicTable();
    SelectStatement selectStatement = table.getSelectStatement();
    VirtualColumn col = new VirtualColumn("virtCol", Column.Type.VARCHAR);
    selectStatement.addResultColumn(col);
    col.setValue("null");
    SQLGenerator gen = getSQLGenerator();
    String query = gen.getQuery(selectStatement);
    assertEquals("SELECT MyIndex, MyName, MyDate, null AS virtCol FROM MySchema.MyTable", query);
  }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.sqls.impl.VirtualColumn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.