Package org.apache.ws.jaxme.sqls

Examples of org.apache.ws.jaxme.sqls.BooleanConstraint.addPart()


      throw new IllegalStateException("The statement of the table reference is not the same as this constraints statement.");
    }
    for (Iterator iter = pSet.getColumns();  iter.hasNext()) {
      Column column = (Column) iter.next();
      BooleanConstraint eq = createEQ();
      eq.addPart(new ColumnReferenceImpl(pTableReference, column));
      eq.addPlaceholder();
    }
  }

  public void addJoin(ForeignKey pKey, TableReference pReferencingTable,
View Full Code Here


    }

    for (Iterator iter = pKey.getColumnLinks();  iter.hasNext()) {
      ForeignKey.ColumnLink columnReference = (ForeignKey.ColumnLink) iter.next();
      BooleanConstraint eq = createEQ();
      eq.addPart(new ColumnReferenceImpl(pReferencingTable, columnReference.getLocalColumn()));
      eq.addPart(new ColumnReferenceImpl(pReferencedTable, columnReference.getReferencedColumn()));
    }
  }

  public void addJoin(TableReference pReferencingTable,
View Full Code Here

    for (Iterator iter = pKey.getColumnLinks();  iter.hasNext()) {
      ForeignKey.ColumnLink columnReference = (ForeignKey.ColumnLink) iter.next();
      BooleanConstraint eq = createEQ();
      eq.addPart(new ColumnReferenceImpl(pReferencingTable, columnReference.getLocalColumn()));
      eq.addPart(new ColumnReferenceImpl(pReferencedTable, columnReference.getReferencedColumn()));
    }
  }

  public void addJoin(TableReference pReferencingTable,
                      ColumnSet pReferencingColumnSet,
View Full Code Here

        if (!referencedIter.hasNext()) {
           throw new IllegalStateException("The size of the referencing and referenced column sets doesn't match.");
        }
        Column referencedColumn = (Column) referencedIter.next();
        BooleanConstraint eq = createEQ();
        eq.addPart(pReferencingTable.newColumnReference(referencingColumn));
        eq.addPart(pReferencedTable.newColumnReference(referencedColumn));
     }
  }

View Full Code Here

           throw new IllegalStateException("The size of the referencing and referenced column sets doesn't match.");
        }
        Column referencedColumn = (Column) referencedIter.next();
        BooleanConstraint eq = createEQ();
        eq.addPart(pReferencingTable.newColumnReference(referencingColumn));
        eq.addPart(pReferencedTable.newColumnReference(referencedColumn));
     }
  }


  public int getNumParts() {
View Full Code Here

        throw new IllegalArgumentException("Invalid boolean constraint type: " + sourceType);
      }
      for (Iterator iter = source.getParts();  iter.hasNext()) {
        Object o = iter.next();
        if (o instanceof Value) {
          target.addPart((Value) o);
        } else if (o instanceof ColumnReference) {
           ColumnReference colRef = (ColumnReference) o;
           TableReference tableRef = (TableReference) pMap.get(colRef.getTableReference());
           if (tableRef == null) {
             throw new IllegalStateException("Unknown reference to table " + colRef.getTableReference().getTable().getQName());
View Full Code Here

           ColumnReference colRef = (ColumnReference) o;
           TableReference tableRef = (TableReference) pMap.get(colRef.getTableReference());
           if (tableRef == null) {
             throw new IllegalStateException("Unknown reference to table " + colRef.getTableReference().getTable().getQName());
           }
           target.addPart(tableRef.newColumnReference(colRef.getColumn()));
        } else {
           throw new IllegalStateException("Unknown part type: " + o.getClass().getName());
        }
      }
    } else {
View Full Code Here

     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 = sqlFactory.newSQLGenerator();
     generator.setLineTerminator("\n");
     String got = generator.getQuery(statement);
View Full Code Here

        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);
View Full Code Here

    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

TOP
Copyright © 2018 www.massapi.com. 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.