org.openanzo.sqlscribe
Class InMatch

java.lang.Object
  extended by org.openanzo.sqlscribe.Match
      extended by org.openanzo.sqlscribe.InMatch
All Implemented Interfaces:
Constraint

public class InMatch
extends Match
implements Constraint

An IN constraint builder. For example "WHERE id IN(SELECT ID FROM TABLE2)" is a simple value constraint on the 'id' column of some table.

Author:
Joe Betz

Constructor Summary
InMatch(Column lhs, Column projection, Constraint... rhs)
          Create a new IN match constraint
 
Method Summary
 java.lang.String getConstraint(java.util.List<java.lang.String> unboundVariables)
          Get the SQL text for this constraint, using any variables from the provided list
 void writeConstraint(java.lang.StringBuffer buf, java.util.List<java.lang.String> unboundVariables)
          Write the SQL text for this constraint to the provided buffer, using any variables from the provided list
 
Methods inherited from class org.openanzo.sqlscribe.Match
equals, equals, getLhs, getOperator, greater, greater, in, isNotNull, isNull, less, less, listTables, varEquals, varGreater, varGreaterEquals, varLess, varLessEquals
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openanzo.sqlscribe.Constraint
listTables
 

Constructor Detail

InMatch

public InMatch(Column lhs,
               Column projection,
               Constraint... rhs)
Create a new IN match constraint

Parameters:
lhs - left side of the constraint
projection - what column should be project out of the right hand side of the query
rhs - the constraints that should be met within the IN sub select
Method Detail

getConstraint

public java.lang.String getConstraint(java.util.List<java.lang.String> unboundVariables)
Description copied from interface: Constraint
Get the SQL text for this constraint, using any variables from the provided list

Specified by:
getConstraint in interface Constraint
Parameters:
unboundVariables - set of variables that can be used within constraints
Returns:
the SQL text for this constraint, using any variables from the provided list

writeConstraint

public void writeConstraint(java.lang.StringBuffer buf,
                            java.util.List<java.lang.String> unboundVariables)
Description copied from interface: Constraint
Write the SQL text for this constraint to the provided buffer, using any variables from the provided list

Specified by:
writeConstraint in interface Constraint
Parameters:
buf - StringBuffer to which the SQL text for this constraint is appended
unboundVariables - set of variables that can be used within constraints


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.