Package org.apache.ws.jaxme.sqls

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


    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


      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 (MyIndex, VerNum) IN ((SELECT RefMyIndex, RefVerNum FROM MySchema.OtherTable WHERE RefMyName=?))";
    String got = gen.getQuery(deleteStatement);
    assertEquals(expect, got);
  }
View Full Code Here

        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 = new SelectStatementMetaData((SelectStatement) st);
        return getBooleanConstraint(selectStatementMetaData, bc);
      } else {
        return getBooleanConstraint(null, bc);
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.