Package org.apache.ws.jaxme.sqls

Examples of org.apache.ws.jaxme.sqls.BooleanConstraint


                return getCombinedConstraint(selectStatementMetaData, cc);
            } else {
                return getCombinedConstraint(null, cc);
            }
        } else if (pConstraint instanceof BooleanConstraint) {
            BooleanConstraint bc = (BooleanConstraint) pConstraint;
            Statement st = bc.getConstrainedStatement();
            if (st instanceof SelectStatement) {
                SelectStatementMetaData selectStatementMetaData = newSelectStatementMetaData((SelectStatement) st);
                return getBooleanConstraint(selectStatementMetaData, bc);
            } else {
                return getBooleanConstraint(null, bc);
View Full Code Here


        TableReference refRef = tableReference.getRightJoinedTableReference();
       
        joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
                refLocal, refRef);
        CombinedConstraint cc = statement.getWhere();
        BooleanConstraint bc = cc.createEQ();
        bc.addPart(tableReference.newColumnReference("MyIndex"));
        bc.addPlaceholder();
        return statement;
    }
View Full Code Here

        TableReference refRef = tableReference.getRightJoinedTableReference();
       
        joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
                refLocal, refRef);
        CombinedConstraint cc = statement.getWhere();
        BooleanConstraint bc = cc.createEQ();
        bc.addPart(tableReference.newColumnReference("MyIndex"));
        bc.addPlaceholder();
       
        SQLGenerator generator = getSQLGenerator();
        generator.setLineTerminator("\n");
        String got = generator.getQuery(statement);
        String expect = getTestLeftOuterJoinResult();
View Full Code Here

        Table otherTable = getForeignKeyTable(table);
        SelectStatement statement = table.getSelectStatement();
        SelectTableReference tableReference = statement.getSelectTableReference();
        SelectStatement existsStatement = otherTable.getSelectStatement();
        SelectTableReference existsTableReference = existsStatement.getSelectTableReference();
        BooleanConstraint bc = existsStatement.getWhere().createEQ();
        bc.addPart(existsTableReference.newColumnReference("RefIndex"));
        bc.addPart(tableReference.newColumnReference("MyIndex"));
        statement.getWhere().createEXISTS(existsStatement);
       
        SQLGenerator generator = getSQLGenerator();
        generator.setLineTerminator("\n");
        String got = generator.getQuery(statement);
View Full Code Here

    /** <p>Test for a BETWEEN clause.</p>
     */
    public void testBetween() {
        Table table = getBasicTable();
        SelectStatement statement = table.getSelectStatement();
    BooleanConstraint between = statement.getWhere().createBETWEEN();
    between.addPart(statement.getTableReference().newColumnReference("MyIndex"));
    between.addPart(3);
    between.addPart(5);

    SQLGenerator generator = getSQLGenerator();
        generator.setLineTerminator("\n");
        String got = generator.getQuery(statement);
        String expect = "SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE MyIndex BETWEEN 3 AND 5";
View Full Code Here

            if (column.isPrimaryKeyPart()) {
                selectStatement.addResultColumn(selectStatement.getTableReference().newColumnReference(refColumn));
                columns.add(deleteStatement.getTableReference().newColumnReference(column));
            }
        }
        BooleanConstraint eq = selectStatement.getWhere().createEQ();
        eq.addPart(selectStatement.getTableReference().newColumnReference("RefMyName"));
        eq.addPlaceholder();
       
        BooleanConstraint bc = deleteStatement.getWhere().createIN();
        bc.addPart((ColumnReference[]) columns.toArray(new ColumnReference[columns.size()]));
        bc.addPart(selectStatement);
        String expect = "DELETE FROM MySchema.MyTable WHERE (MyTable.MyIndex, VerNum) IN ((SELECT RefMyIndex, RefVerNum FROM MySchema.OtherTable WHERE RefMyName=?))";
        String got = gen.getQuery(deleteStatement);
        assertEquals(expect, got);
    }
View Full Code Here

    public void testNOT() {
        Table table = getBasicTable();
        SelectStatement selectStatement = table.getSelectStatement();
        SelectTableReference ref = selectStatement.getSelectTableReference();
        CombinedConstraint and = selectStatement.getWhere();
        BooleanConstraint bc = and.createLIKE();
        bc.addPart(ref.newColumnReference("MyName"));
        bc.addPart("%a%");
        CombinedConstraint or = and.createOrConstraint();
        or.setNOT(true);
        bc = or.createEQ();
        bc.addPart(ref.newColumnReference("MyIndex"));
        bc.addPart(1);
        SQLGenerator gen = getSQLGenerator();
        String query = gen.getQuery(selectStatement);
        assertEquals("SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE (MyName LIKE '%a%' AND NOT (MyIndex=1))", query);

        bc = or.createEQ();
        bc.addPart(ref.newColumnReference("MyIndex"));
        bc.addPart(2);
        query = gen.getQuery(selectStatement);
        assertEquals("SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE (MyName LIKE '%a%' AND (NOT (MyIndex=1 OR MyIndex=2)))", query);
    }
View Full Code Here

   */
  public void testExpressions() {
    Table t = getBasicTable();
    SelectStatement st = t.getSelectStatement();
    SelectTableReference ref = st.getSelectTableReference();
    BooleanConstraint bc = st.getWhere().createGT();
    Expression e1 = bc.createSUM();
    e1.addPart(ref.newColumnReference("MyIndex"));
    e1.addPart(3);
    Expression e2 = bc.createSUM();
    e2.addPart(5);
        SQLGenerator gen = getSQLGenerator();
        String got = gen.getQuery(st);
    String expect = "SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable WHERE (MyIndex+3)>5";
    assertEquals(expect, got);
View Full Code Here

    public void testConnectByPrior() {
        Table table = getBasicTable();
        OraSelectStatement selectStatement = (OraSelectStatement) table.getSelectStatement();
        SelectTableReference ref = selectStatement.getSelectTableReference();
        CombinedConstraint startWith = selectStatement.getStartWith();
        BooleanConstraint bc = startWith.createEQ();
        bc.addPart(ref.newColumnReference("MyIndex"));
        bc.addPart(1);
        CombinedConstraint connectByPrior = selectStatement.getConnectBy();
        bc = connectByPrior.createEQ();
        OraColumnReference oraRef = (OraColumnReference) ref.newColumnReference("MyIndex");
        oraRef.setPrior(true);
        bc.addPart(oraRef);
        bc.addPart(ref.newColumnReference("MyName"));
        SQLGenerator gen = getSQLGenerator();
        String query = gen.getQuery(selectStatement);
        assertEquals("SELECT MyIndex, MyName, MyDate FROM MySchema.MyTable START WITH MyIndex=1 CONNECT BY PRIOR MyIndex=MyName", query);
    }
View Full Code Here

     *   a.aID = DBBeteiligte.aAktenId
     * </pre></p>
     */
    private void addAktenId(CombinedConstraint pWhere,
              TableReference pAkteReference, TableReference pBeteiligteReference) {
        BooleanConstraint bc = pWhere.createEQ();
        bc.addPart(pBeteiligteReference.newColumnReference(dbBeteiligte.getColumn("aAktenId")));
        bc.addPart(pAkteReference.newColumnReference(dbAkte.getColumn("aId")));
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.sqls.BooleanConstraint

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.