Holger's
Java API

com.antelmann.sql
Class SQLQueryClause

java.lang.Object
  extended by com.antelmann.sql.SQLQueryClause
All Implemented Interfaces:
SQLConstraint, Serializable

public class SQLQueryClause
extends Object
implements SQLConstraint

a special constraint that is taken literally, meaning the string given in the constructor is the exact string used in the final SQL. When used in a restriction map, the key value (normally denoting the column name in question) that is used to map this instance is completely ignored when constructing the SQL, so you may use whatever unique string to put the instance into a restriction map.

Since:
23.06.2009, 17:05:34
Author:
Holger Antelmann
See Also:
ConnectionHelper.addWhereClause(Appendable, java.util.List, java.util.Map, boolean), SQLMapFilter, Serialized Form

Field Summary
 
Fields inherited from interface com.antelmann.sql.SQLConstraint
IS_NULL, NOT_NULL
 
Constructor Summary
SQLQueryClause(String queryClause, Object... parameters)
           
 
Method Summary
 Object[] getParameters()
           
 String getQueryClause()
           
static SQLQueryClause parseAsDoubleRange(String column, String line)
          see parseAsNumberRange(NumberStringFilter, String)
static SQLQueryClause parseAsIntegerRange(String column, String line)
          see parseAsNumberRange(NumberStringFilter, String)
static
<T extends Number & Comparable<? super T>>
SQLQueryClause
parseAsNumberRange(NumberStringFilter<T> filter, String column)
          creates an SQLQueryClause from an input string supporting different number strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLQueryClause

public SQLQueryClause(String queryClause,
                      Object... parameters)
Parameters:
queryClause - the part that is placed literally into the final SQL statement
parameters - allows to define parameters that are to be used in a PreparedStatement with this instance
Method Detail

getQueryClause

public String getQueryClause()

getParameters

public Object[] getParameters()

parseAsIntegerRange

public static SQLQueryClause parseAsIntegerRange(String column,
                                                 String line)
                                          throws NumberFormatException
see parseAsNumberRange(NumberStringFilter, String)

Throws:
NumberFormatException

parseAsDoubleRange

public static SQLQueryClause parseAsDoubleRange(String column,
                                                String line)
                                         throws NumberFormatException
see parseAsNumberRange(NumberStringFilter, String)

Throws:
NumberFormatException

parseAsNumberRange

public static <T extends Number & Comparable<? super T>> SQLQueryClause parseAsNumberRange(NumberStringFilter<T> filter,
                                                                                          String column)
                                         throws NumberFormatException
creates an SQLQueryClause from an input string supporting different number strings. This method also supports semicolon as separators as well as numbers in double format.

Parameters:
column - the database table column that is to be constrained through the given line
Returns:
an SQLQueryClause that constrains the given column as defined in the given line
Throws:
NumberFormatException - when the given line is not in a proper format
See Also:
NumberStringFilter


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads