interface
In the next examples the basic implementations have been used:
Example for a simple expression:
Operator equalOperator=BasicOperator.EQUAL_OP;
Field field = new BasicField("columnName1");
Expression expression = new BasicExpression(field,equalOperator,"filterValue");
Hashtable conditions=new Hashtable();
conditions.put(ExtendedSQLConditionValuesProcessor.EXPRESSION_KEY,expression);
Example for a complex expression:
Operator equalOperator=BasicOperator.EQUAL_OP;
Field field1 = new BasicField("columnName1");
Expression expression1 = new BasicExpression(field1,equalOperator,"filterValue");
Field field2 = new BasicField("columnName2");
Expression expression2 = new BasicExpression(field2,BasicOperator.LESS,new Integer(10));
Expression totalExpression = new Expression(expression1,BasicOperator.AND,expression2);
Hashtable conditions=new Hashtable();
conditions.put(ExtendedSQLConditionValuesProcessor.EXPRESSION_KEY,totalExpression);
- Author:
- Imatia Innovation S.L.
- See Also:
SQLStatementBuilder.Expression
|
Field Summary |
static java.lang.String |
EXPRESSION_KEY
Identifier used as condition key when has a complex expression. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EXPRESSION_KEY
public static final java.lang.String EXPRESSION_KEY
- Identifier used as condition key when has a complex expression.
- See Also:
- Constant Field Values
SQLStatementBuilder.ExtendedSQLConditionValuesProcessor
public SQLStatementBuilder.ExtendedSQLConditionValuesProcessor()
SQLStatementBuilder.ExtendedSQLConditionValuesProcessor
public SQLStatementBuilder.ExtendedSQLConditionValuesProcessor(boolean upperLike)
- Creates a
ExtendedSQLConditionValuesProcessor where every
condition that uses LIKE is case-insensitive.
Inserts a upper function in both sides of LIKE conditions
(UPPER(Field) LIKE UPPER(Value))
- Parameters:
upperLike - true if the LIKE condition should be case-insensitive
SQLStatementBuilder.ExtendedSQLConditionValuesProcessor
public SQLStatementBuilder.ExtendedSQLConditionValuesProcessor(boolean upperStrings,
boolean upperLike)
- Creates a
ExtendedSQLConditionValuesProcessor where every
condition that uses LIKE or is a column of String type is
case-insensitive.
Inserts a upper function in both sides of LIKE conditions
(UPPER(Field) LIKE UPPER(Value)) Inserts a upper function in both sides
if column type is a String (UPPER(Field) LIKE UPPER(String))
- Parameters:
upperStrings - true if the String column type should be case-insensitiveupperLike - true if the LIKE condition should be case-insensitive
getColumnName
protected java.lang.String getColumnName(java.lang.String name)
- Returns the column name in square bracket if the name contains a
special characters
- Parameters:
name - column name to checks
- Returns:
- the column name in square bracket if it's necessary
createQueryConditionsExpress
public static java.lang.String createQueryConditionsExpress(SQLStatementBuilder.Expression expression)
- Creates the condition string from a expression. This condition string
be used after WHERE clause in the SQL Statement.
- Parameters:
expression - a class that implements Expression interface
- Returns:
- a String where is stored a condition in text format
createQueryConditionsExpress
public static void createQueryConditionsExpress(SQLStatementBuilder.Expression expression,
java.lang.StringBuffer sb)
- Creates the condition string from a expression.
- Parameters:
expression - a class that implements Expression interfacesb - StringBuffer where the condition string is
stored.
renderQueryConditionsFromExpression
protected java.lang.String renderQueryConditionsFromExpression(SQLStatementBuilder.Expression expression)
renderQueryConditionsFromExpression
protected void renderQueryConditionsFromExpression(SQLStatementBuilder.Expression expression,
java.lang.StringBuffer sb)
createQueryConditionsFromExpression
protected java.lang.String createQueryConditionsFromExpression(SQLStatementBuilder.Expression expression,
java.util.Vector values)
- Creates the condition string from a expression and stores required
values in a vector.
- Parameters:
expression - a class that implements Expression interfacevalues - a list where the required values for the condition are stored
- Returns:
- a
String where is stored a condition in text
format
createQueryConditionsFromExpression
protected void createQueryConditionsFromExpression(SQLStatementBuilder.Expression expression,
java.util.Vector values,
java.lang.StringBuffer sb)
- Creates the condition string from a expression. The condition string is
stored in the
StringBuffer param and the required values
in a Vector param
- Parameters:
expression - a class that implements Expression interfacevalues - a list where the required values for the condition are storedsb - a StringBuffer where the condition string is
stored
createQueryConditions
public java.lang.String createQueryConditions(java.util.Hashtable conditions,
java.util.Vector wildcards,
java.util.Vector values)
- Creates the condition string for a SQL Statement.
- Specified by:
createQueryConditions in interface SQLStatementBuilder.SQLConditionValuesProcessor- Overrides:
createQueryConditions in class SQLStatementBuilder.DefaultSQLConditionValuesProcessor
- Parameters:
conditions - a condition listwildcards - column list that can use wildcardsvalues - vector where the value of each processed conditions is stored
- Returns: