/** * Constructor for SubQueryConstraint object. * * @param left the AbstractValue on the left of the constraint * @param right the Query containing the results. The query should only have one column in its * results. */ public SubQueryConstraint(AbstractValue left, Query right) { if (left == null) { throw (new NullPointerException("left cannot be null")); } if (right == null) { throw (new NullPointerException("right cannot be null")); } if (right.getSelect().size() != 1) { throw (new IllegalArgumentException("right must have one result column only")); } this.left = left; this.right = right; }
/** * Constructor for SubQueryConstraint object. * * @param left the AbstractValue on the left of the constraint * @param right the Query containing the results. The query should only have one column in its * results. */ public SubQueryConstraint(AbstractValue left, Query right) { if (left == null) { throw (new NullPointerException("left cannot be null")); } if (right == null) { throw (new NullPointerException("right cannot be null")); } if (right.getSelect().size() != 1) { throw (new IllegalArgumentException("right must have one result column only")); } this.left = left; this.right = right; }
/** * Returns a String representation of this SubQueryConstraint object, suitable for forming part * of an SQL Query. * * @return the String representation */ @Override public String getSQLString() { if (right.getSelect().size() != 1) { throw (new IllegalStateException("Right must have one result column only")); } return left.getSQLString() + " IN (" + right.getSQLString() + ")"; }
/** * Returns a String representation of this SubQueryConstraint object, suitable for forming part * of an SQL Query. * * @return the String representation */ @Override public String getSQLString() { if (right.getSelect().size() != 1) { throw (new IllegalStateException("Right must have one result column only")); } return left.getSQLString() + " IN (" + right.getSQLString() + ")"; }
for (SelectValue value : q.getSelect()) { valueMap.put(value.getValue(), value);
if (conC.right.getSelect().size() != 1) { throw (new IllegalStateException("Right must have one result column only"));
for (SelectValue value : q.getSelect()) { valueMap.put(value.getValue(), value);
if (conC.right.getSelect().size() != 1) { throw (new IllegalStateException("Right must have one result column only"));
for (SelectValue newSelectSV : newQuery.getSelect()) { newS.add(newSelectSV.getValue());
for (SelectValue newSelectSV : newQuery.getSelect()) { newS.add(newSelectSV.getValue());
expectedSelect.add(se4); assertEquals(expectedSelect, newQuery.getSelect());
reconstructSelectValues(query.getSelect(), precomputedSqlTable, valueMap, precompQuery.getFrom(), true, newQuery);
reconstructSelectValues(query.getSelect(), precomputedSqlTable, valueMap, precompQuery.getFrom(), true, newQuery);