Ontimize 5.2072EN

com.ontimize.db
Class SQLStatementBuilder

java.lang.Object
  extended bycom.ontimize.db.SQLStatementBuilder

public abstract class SQLStatementBuilder
extends java.lang.Object

The SQLStatementBuilder class builds SQL statements

This class is used by every entity to build the SQL Statements needed to query the database.

Author:
Imatia Innovation S.L.

Nested Class Summary
static class SQLStatementBuilder.BasicExpression
          Default implementation of Expression interfaces.
static class SQLStatementBuilder.BasicField
          Default implementation of Field interfaces.
static class SQLStatementBuilder.BasicOperator
          Default implementation of Operator interfaces.
static class SQLStatementBuilder.DefaultSQLConditionValuesProcessor
          This class provides default implementations for the SQLConditionValuesProcessor interface.
static interface SQLStatementBuilder.Expression
          This interface defines the basic methods that must be implemented by any class that defines a expression to be processed in SQLConditionValuesProcessor
static class SQLStatementBuilder.ExtendedSQLConditionValuesProcessor
          This class provides a implementation of the SQLConditionValuesProcessor interface.
static interface SQLStatementBuilder.Field
          This interface defines the basic methods that must be implemented by any class that stores the name of the column that is used by the Expression when it's processed by SQLConditionValuesProcessor.
static class SQLStatementBuilder.NoWildCard
          This class is used for avoid using wildcard when the condition string is created in SQLConditionValuesProcessor
static interface SQLStatementBuilder.Operator
          This interface defines the basic methods that must be implemented by every class that defines the operation that is used by the Expression when it's processed by SQLConditionValuesProcessor.
static interface SQLStatementBuilder.SQLConditionValuesProcessor
          This interface defines the basic method that must be implemented by any class that creates the condition string for a SQL Statement.
static class SQLStatementBuilder.SQLExpression
          This class is used to store a SQL Statement and the required values to be processed in SQLConditionValuesProcessor.
static interface SQLStatementBuilder.SQLNameEval
           
static class SQLStatementBuilder.SQLOrder
           
static class SQLStatementBuilder.SQLStatement
          This class is used to store the information to create a SQL statement and the required values.
 
Field Summary
static java.lang.String ACCESS_HANDLER
           
static java.lang.String AND
           
static java.lang.String ASTERISK
           
static char ASTERISK_CHAR
           
static boolean checkParenthesis
           
static java.lang.String CLOSE_PARENTHESIS
           
static java.lang.String CLOSE_SQUARE_BRACKET
           
static java.lang.String COMMA
           
static java.lang.String COUNT
           
static java.lang.String COUNT_COLUMN_NAME
           
static boolean DEBUG
          Debugging purposes variable.
static java.lang.String DEFAULT_HANDLER
           
static java.lang.String DELETE_FROM
           
static java.lang.String DESC
           
static java.lang.String DISTINCT
           
static java.lang.String EQUAL
           
static java.lang.String EQUAL_XQUESTIONMARK
           
static java.lang.String FROM
           
static java.lang.String HSQLDB_HANDLER
           
static java.lang.String IN
           
static java.lang.String INSERT_INTO
           
static char INTERROG
           
static java.lang.String IS_NULL
           
static java.lang.String LESS_EQUAL
           
static java.lang.String LESS_EQUAL_XQUESTIONMARK
           
static java.lang.String LESS_XQUESTIONMARK
           
static java.lang.String LIKE
           
static char LOW_LINE
           
static java.lang.String MORE_EQUAL
           
static java.lang.String MORE_EQUAL_XQUESTIONMARK
           
static java.lang.String MORE_XQUESTIONMARK
           
static java.lang.String MYSQL_HANDLER
           
static java.lang.String NOT_EQUAL
           
static java.lang.String NOT_EQUAL_ID
           
static java.lang.String NOT_EQUAL_XQUESTIONMARK
           
static java.lang.String NOT_LIKE
           
static java.lang.String NULL
           
static java.lang.String OPEN_PARENTHESIS
           
static java.lang.String OPEN_SQUARE_BRACKET
           
static java.lang.String OR
           
static java.lang.String ORACLE_HANDLER
           
static java.lang.String ORDER_BY
           
static char PERCENT
           
static java.lang.String POSTGRES_HANDLER
           
static java.lang.String QUESTIONMARK
           
protected static java.util.Hashtable registerHandlers
           
static java.lang.String SELECT
           
static java.lang.String SET
           
static java.lang.String SPACE
           
static java.lang.String SQLSERVER_HANDLER
           
static java.lang.String TOP
           
static java.lang.String UPDATE
           
static boolean useAsInSubqueries
          Deprecated. Use:
static java.lang.String VALUES
           
static java.lang.String WHERE
           
 
Constructor Summary
SQLStatementBuilder()
           
 
Method Summary
static void addSpecialCharacters(char[] c)
          Adds characters to the list of special characters.
static SQLStatementBuilder.SQLStatement createCountQuery(java.lang.String table, java.util.Hashtable conditions, java.util.Vector wildcards)
          Returns a SQLStatement class that stores the information needed to execute a query that obtains the number of query records
static SQLStatementBuilder.SQLStatement createDeleteQuery(java.lang.String table, java.util.Hashtable keysValues)
          Returns a SQLStatement class that stores the information needed to execute a delete query.
static SQLStatementBuilder.SQLStatement createInsertQuery(java.lang.String table, java.util.Hashtable attributes)
          Returns a SQLStatement class that stores the information needed to execute a insert query.
static SQLStatementBuilder.SQLStatement createJoinSelectQuery(java.lang.String principalTable, java.lang.String secondaryTable, java.util.Vector principalKeys, java.util.Vector secondaryKeys, java.util.Vector principalTableRequestedColumns, java.util.Vector secondaryTableRequestedColumns, java.util.Hashtable principalTableConditions, java.util.Hashtable secondaryTableConditions, java.util.Vector wildcards, java.util.Vector columnSorting, boolean forceDistinct)
          Returns a SQLStatement class that stores the information needed to execute a select query against two table used a join.
static SQLStatementBuilder.SQLStatement createJoinSelectQuery(java.lang.String mainTable, java.lang.String secondaryTable, java.util.Vector mainKeys, java.util.Vector secondaryKeys, java.util.Vector mainTableRequestedColumns, java.util.Vector secondaryTableRequestedColumns, java.util.Hashtable mainTableConditions, java.util.Hashtable secondaryTableConditions, java.util.Vector wildcards, java.util.Vector columnSorting, boolean forceDistinct, boolean descending)
          Returns a SQLStatement class that stores the information needed to execute a select query against two table used a join.
static java.lang.String createQueryConditionsWithoutWhere(java.util.Hashtable conditions, java.util.Vector wildcard, java.util.Vector values)
           
static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table, java.util.Vector requestedColumns, java.util.Hashtable conditions, java.util.Vector wildcards)
          Returns a SQLStatement class that stores the information needed to execute a select query.
static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table, java.util.Vector requestedColumns, java.util.Hashtable conditions, java.util.Vector wildcards, java.util.Vector columnSorting)
          Returns a SQLStatement class that stores the information needed to execute a select query.
static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table, java.util.Vector requestedColumns, java.util.Hashtable conditions, java.util.Vector wildcards, java.util.Vector columnSorting, boolean descending)
          Returns a SQLStatement class that stores the information needed to execute a select query.
static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table, java.util.Vector requestedColumns, java.util.Hashtable conditions, java.util.Vector wildcards, java.util.Vector columnSorting, boolean descending, boolean forceDistinct)
          Returns a SQLStatement class that stores the information needed to execute a select query.
static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table, java.util.Vector requestedColumns, java.util.Hashtable conditions, java.util.Vector wildcards, java.util.Vector columnSorting, int recordCount)
          Returns a SQLStatement class that stores the information needed to execute a select query.
static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table, java.util.Vector requestedColumns, java.util.Hashtable conditions, java.util.Vector wildcards, java.util.Vector columnSorting, int recordCount, boolean descending)
          Returns a SQLStatement class that stores the information needed to execute a select query.
static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table, java.util.Vector requestedColumns, java.util.Hashtable conditions, java.util.Vector wildcards, java.util.Vector columnSorting, int recordCount, boolean descending, boolean forceDistinct)
          Returns a SQLStatement class that stores the information needed to execute a select query.
static SQLStatementBuilder.SQLStatement createUpdateQuery(java.lang.String table, java.util.Hashtable attributesValues, java.util.Hashtable keysValues)
          Returns a SQLStatement class that stores the information needed to execute a update query.
static SQLStatementBuilder.SQLConditionValuesProcessor getQueryConditionsProcessor()
          Returns a instance of SQLConditionValuesProcessor that be used in this class to create the condition string
static SQLStatementBuilder.SQLNameEval getSQLNameEval()
           
static SQLStatementHandler getSQLStatementHandler(java.lang.String handlerID)
           
static boolean isUseAsInSubqueries()
           
static java.lang.String qualify(java.lang.String col, java.lang.String table)
          Returns a String with the qualified name.
static void registerSQLStatementHandler(java.lang.String handlerID, SQLStatementHandler handler)
           
static void setSQLConditionValuesProcessor(SQLStatementBuilder.SQLConditionValuesProcessor processor)
          Sets the SQLConditionValuesProcessor to be used in SQLStatementBuilder
static void setSQLNameEval(SQLStatementBuilder.SQLNameEval eval)
           
static void setUseAsInSubqueries(boolean useAsInSubqueries)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HANDLER

public static final java.lang.String DEFAULT_HANDLER
See Also:
Constant Field Values

POSTGRES_HANDLER

public static final java.lang.String POSTGRES_HANDLER
See Also:
Constant Field Values

SQLSERVER_HANDLER

public static final java.lang.String SQLSERVER_HANDLER
See Also:
Constant Field Values

ORACLE_HANDLER

public static final java.lang.String ORACLE_HANDLER
See Also:
Constant Field Values

HSQLDB_HANDLER

public static final java.lang.String HSQLDB_HANDLER
See Also:
Constant Field Values

ACCESS_HANDLER

public static final java.lang.String ACCESS_HANDLER
See Also:
Constant Field Values

MYSQL_HANDLER

public static final java.lang.String MYSQL_HANDLER
See Also:
Constant Field Values

registerHandlers

protected static final java.util.Hashtable registerHandlers

useAsInSubqueries

public static boolean useAsInSubqueries
Deprecated. Use:

See Also:
DefaultSQLStatementHandler.useAsInSubqueries

DEBUG

public static boolean DEBUG
Debugging purposes variable. If enabled, debugging information will be sent to standard output.


SELECT

public static final java.lang.String SELECT
See Also:
Constant Field Values

DISTINCT

public static final java.lang.String DISTINCT
See Also:
Constant Field Values

WHERE

public static final java.lang.String WHERE
See Also:
Constant Field Values

FROM

public static final java.lang.String FROM
See Also:
Constant Field Values

LIKE

public static final java.lang.String LIKE
See Also:
Constant Field Values

NOT_LIKE

public static final java.lang.String NOT_LIKE
See Also:
Constant Field Values

AND

public static final java.lang.String AND
See Also:
Constant Field Values

OR

public static final java.lang.String OR
See Also:
Constant Field Values

IN

public static final java.lang.String IN
See Also:
Constant Field Values

COMMA

public static final java.lang.String COMMA
See Also:
Constant Field Values

QUESTIONMARK

public static final java.lang.String QUESTIONMARK
See Also:
Constant Field Values

OPEN_PARENTHESIS

public static final java.lang.String OPEN_PARENTHESIS
See Also:
Constant Field Values

CLOSE_PARENTHESIS

public static final java.lang.String CLOSE_PARENTHESIS
See Also:
Constant Field Values

checkParenthesis

public static boolean checkParenthesis

ASTERISK

public static final java.lang.String ASTERISK
See Also:
Constant Field Values

OPEN_SQUARE_BRACKET

public static final java.lang.String OPEN_SQUARE_BRACKET
See Also:
Constant Field Values

CLOSE_SQUARE_BRACKET

public static final java.lang.String CLOSE_SQUARE_BRACKET
See Also:
Constant Field Values

EQUAL_XQUESTIONMARK

public static final java.lang.String EQUAL_XQUESTIONMARK
See Also:
Constant Field Values

NOT_EQUAL_XQUESTIONMARK

public static final java.lang.String NOT_EQUAL_XQUESTIONMARK
See Also:
Constant Field Values

EQUAL

public static final java.lang.String EQUAL
See Also:
Constant Field Values

NOT_EQUAL

public static final java.lang.String NOT_EQUAL
See Also:
Constant Field Values

NOT_EQUAL_ID

public static final java.lang.String NOT_EQUAL_ID
See Also:
Constant Field Values

IS_NULL

public static final java.lang.String IS_NULL
See Also:
Constant Field Values

NULL

public static final java.lang.String NULL
See Also:
Constant Field Values

MORE_EQUAL

public static final java.lang.String MORE_EQUAL
See Also:
Constant Field Values

LESS_EQUAL

public static final java.lang.String LESS_EQUAL
See Also:
Constant Field Values

MORE_EQUAL_XQUESTIONMARK

public static final java.lang.String MORE_EQUAL_XQUESTIONMARK
See Also:
Constant Field Values

LESS_EQUAL_XQUESTIONMARK

public static final java.lang.String LESS_EQUAL_XQUESTIONMARK
See Also:
Constant Field Values

LESS_XQUESTIONMARK

public static final java.lang.String LESS_XQUESTIONMARK
See Also:
Constant Field Values

MORE_XQUESTIONMARK

public static final java.lang.String MORE_XQUESTIONMARK
See Also:
Constant Field Values

COUNT_COLUMN_NAME

public static final java.lang.String COUNT_COLUMN_NAME
See Also:
Constant Field Values

COUNT

public static final java.lang.String COUNT
See Also:
Constant Field Values

TOP

public static final java.lang.String TOP
See Also:
Constant Field Values

ORDER_BY

public static final java.lang.String ORDER_BY
See Also:
Constant Field Values

DESC

public static final java.lang.String DESC
See Also:
Constant Field Values

INSERT_INTO

public static final java.lang.String INSERT_INTO
See Also:
Constant Field Values

VALUES

public static final java.lang.String VALUES
See Also:
Constant Field Values

DELETE_FROM

public static final java.lang.String DELETE_FROM
See Also:
Constant Field Values

UPDATE

public static final java.lang.String UPDATE
See Also:
Constant Field Values

SET

public static final java.lang.String SET
See Also:
Constant Field Values

SPACE

public static final java.lang.String SPACE
See Also:
Constant Field Values

ASTERISK_CHAR

public static char ASTERISK_CHAR

INTERROG

public static char INTERROG

PERCENT

public static char PERCENT

LOW_LINE

public static char LOW_LINE
Constructor Detail

SQLStatementBuilder

public SQLStatementBuilder()
Method Detail

getSQLStatementHandler

public static SQLStatementHandler getSQLStatementHandler(java.lang.String handlerID)

registerSQLStatementHandler

public static void registerSQLStatementHandler(java.lang.String handlerID,
                                               SQLStatementHandler handler)

isUseAsInSubqueries

public static boolean isUseAsInSubqueries()

setUseAsInSubqueries

public static void setUseAsInSubqueries(boolean useAsInSubqueries)

setSQLConditionValuesProcessor

public static void setSQLConditionValuesProcessor(SQLStatementBuilder.SQLConditionValuesProcessor processor)
Sets the SQLConditionValuesProcessor to be used in SQLStatementBuilder

Parameters:
processor - the SQLConditionValuesProcessor instance that be used

createCountQuery

public static SQLStatementBuilder.SQLStatement createCountQuery(java.lang.String table,
                                                                java.util.Hashtable conditions,
                                                                java.util.Vector wildcards)
Returns a SQLStatement class that stores the information needed to execute a query that obtains the number of query records

Parameters:
table - name of the table the query is executed against
conditions - condition list used in the query
wildcards - column list that can use wildcards
Returns:
a SQLStatement class

createSelectQuery

public static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table,
                                                                 java.util.Vector requestedColumns,
                                                                 java.util.Hashtable conditions,
                                                                 java.util.Vector wildcards)
Returns a SQLStatement class that stores the information needed to execute a select query.

Parameters:
table - name of the table the query is executed against
requestedColumns - a Vector specifying the requested column name in the query
conditions - condition list used to created the query
wildcards -
Returns:
a SQLStatement class
See Also:
SQLStatementBuilder.SQLStatement

createSelectQuery

public static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table,
                                                                 java.util.Vector requestedColumns,
                                                                 java.util.Hashtable conditions,
                                                                 java.util.Vector wildcards,
                                                                 java.util.Vector columnSorting,
                                                                 int recordCount)
Returns a SQLStatement class that stores the information needed to execute a select query.

Parameters:
table - name of the table the query is executed against
requestedColumns - a Vector specifying the requested column name in the query
conditions - condition list used to created the query
wildcards - column list that can use wildcards
columnSorting - column list where query sorting is established
recordCount - number of records requested in the query
Returns:
a SQLStatement class
See Also:
SQLStatementBuilder.SQLStatement

createSelectQuery

public static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table,
                                                                 java.util.Vector requestedColumns,
                                                                 java.util.Hashtable conditions,
                                                                 java.util.Vector wildcards,
                                                                 java.util.Vector columnSorting,
                                                                 int recordCount,
                                                                 boolean descending)
Returns a SQLStatement class that stores the information needed to execute a select query.

Parameters:
table - name of the table the query is executed against
requestedColumns - a Vector specifying the requested column name in the query
conditions - condition list used to created the query
wildcards - column list that can use wildcards
columnSorting - column list where query sorting is established
recordCount - number of records requested in the query
descending - true if sorting should be descending
Returns:
a SQLStatement class
See Also:
SQLStatementBuilder.SQLStatement

createSelectQuery

public static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table,
                                                                 java.util.Vector requestedColumns,
                                                                 java.util.Hashtable conditions,
                                                                 java.util.Vector wildcards,
                                                                 java.util.Vector columnSorting,
                                                                 int recordCount,
                                                                 boolean descending,
                                                                 boolean forceDistinct)
Returns a SQLStatement class that stores the information needed to execute a select query.

Parameters:
table - name of the table the query is executed against
requestedColumns - a Vector specifying the requested column name in the query
conditions - condition list used to created the query
wildcards - column list that can use wildcards
columnSorting - column list where query sorting is established
recordCount - number of records requested in the query
forceDistinct - true if query result cannot have duplicated records
descending - true if sorting should be descending
Returns:
a SQLStatement class
See Also:
SQLStatementBuilder.SQLStatement

createSelectQuery

public static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table,
                                                                 java.util.Vector requestedColumns,
                                                                 java.util.Hashtable conditions,
                                                                 java.util.Vector wildcards,
                                                                 java.util.Vector columnSorting)
Returns a SQLStatement class that stores the information needed to execute a select query.

Parameters:
table - name of the table the query is executed against
requestedColumns - a Vector specifying the requested column name in the query
conditions - condition list used to created the query
wildcards - column list that can use wildcards
columnSorting - column list where query sorting is established
Returns:
a SQLStatement class
See Also:
SQLStatementBuilder.SQLStatement

createSelectQuery

public static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table,
                                                                 java.util.Vector requestedColumns,
                                                                 java.util.Hashtable conditions,
                                                                 java.util.Vector wildcards,
                                                                 java.util.Vector columnSorting,
                                                                 boolean descending)
Returns a SQLStatement class that stores the information needed to execute a select query.

Parameters:
table - name of the table the query is executed against
requestedColumns - a Vector specifying the requested column name in the query
conditions - condition list used to created the query
wildcards - column list that can use wildcards
columnSorting - column list where query sorting is established
descending - true if sorting should be descending
Returns:
a SQLStatement class
See Also:
SQLStatementBuilder.SQLStatement

createSelectQuery

public static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table,
                                                                 java.util.Vector requestedColumns,
                                                                 java.util.Hashtable conditions,
                                                                 java.util.Vector wildcards,
                                                                 java.util.Vector columnSorting,
                                                                 boolean descending,
                                                                 boolean forceDistinct)
Returns a SQLStatement class that stores the information needed to execute a select query.

Parameters:
table - name of the table the query is executed against
requestedColumns - a Vector specifying the requested column name in the query
conditions - condition list used to created the query
wildcards - column list that can use wildcards
columnSorting - column list where query sorting is established
forceDistinct - true if query result cannot have duplicated records
descending - true if sorting should be descending
Returns:
a SQLStatement class
See Also:
SQLStatementBuilder.SQLStatement

setSQLNameEval

public static void setSQLNameEval(SQLStatementBuilder.SQLNameEval eval)

getSQLNameEval

public static SQLStatementBuilder.SQLNameEval getSQLNameEval()

createInsertQuery

public static SQLStatementBuilder.SQLStatement createInsertQuery(java.lang.String table,
                                                                 java.util.Hashtable attributes)
Returns a SQLStatement class that stores the information needed to execute a insert query.

Parameters:
table - name of the table the query is executed against
attributes - attributes a Hashtable specifying pairs of key-value corresponding to the attribute (or column of a table in a database) and the value that must be stored.
Returns:

createUpdateQuery

public static SQLStatementBuilder.SQLStatement createUpdateQuery(java.lang.String table,
                                                                 java.util.Hashtable attributesValues,
                                                                 java.util.Hashtable keysValues)
Returns a SQLStatement class that stores the information needed to execute a update query.

Parameters:
table - name of the table the update is executed against
attributesValues - attributesValues the data for updating the records to. The keys specify the attributes (or columns) and the values, the values for these columns.
keysValues - keysValues the conditions that the records to be updated must fulfill. The keys specify the attributes (or columns) and the values, the values for these columns.
Returns:
See Also:
SQLStatementBuilder.SQLStatement

createDeleteQuery

public static SQLStatementBuilder.SQLStatement createDeleteQuery(java.lang.String table,
                                                                 java.util.Hashtable keysValues)
Returns a SQLStatement class that stores the information needed to execute a delete query.

Parameters:
table - name of the table the query is executed against
keysValues - the conditions that the records to be deleted must fulfill. The keys specify the attributes (or columns) and the values, the values for these columns.
Returns:

addSpecialCharacters

public static void addSpecialCharacters(char[] c)
Adds characters to the list of special characters.

When the query is be created if a column name contains a character of the list this column name is inserted between parenthesis in the query.

Parameters:
c - a array with the new characters

createJoinSelectQuery

public static SQLStatementBuilder.SQLStatement createJoinSelectQuery(java.lang.String principalTable,
                                                                     java.lang.String secondaryTable,
                                                                     java.util.Vector principalKeys,
                                                                     java.util.Vector secondaryKeys,
                                                                     java.util.Vector principalTableRequestedColumns,
                                                                     java.util.Vector secondaryTableRequestedColumns,
                                                                     java.util.Hashtable principalTableConditions,
                                                                     java.util.Hashtable secondaryTableConditions,
                                                                     java.util.Vector wildcards,
                                                                     java.util.Vector columnSorting,
                                                                     boolean forceDistinct)
Returns a SQLStatement class that stores the information needed to execute a select query against two table used a join.

Parameters:
principalTable - name of the principal table the query is executed against
secondaryTable - name of the secondary table the query is executed against
principalKeys - a Vector specifying the column names of the principal table that be used to combine the two tables
secondaryKeys - a Vector specifying the column names of the secondary table that be used to combine the two tables
principalTableRequestedColumns - column list that be requested in the query from principal table
secondaryTableRequestedColumns - column list that be requested in the query from secondary table
principalTableConditions - a Hashtable specifying conditions that must comply the set of records returned from principal table
secondaryTableConditions - a Hashtable specifying conditions that must comply the set of records returned from secondary table
wildcards - column list which wildcards can be used in
columnSorting - column list where query sorting is established
forceDistinct - true if query result cannot have duplicated records
Returns:
a SQLStatement class which stores the SQL Statement and the required values

qualify

public static java.lang.String qualify(java.lang.String col,
                                       java.lang.String table)
Returns a String with the qualified name.

This static methods creates a qualified name from the column name and the table name. The used pattern is table_name.column_name. If the table name or the column name has special characters, square brackets are used [table_name].[column_name]

Parameters:
col - a String with the column name
table - a String with the table name
Returns:
a String with the qualified name.

createJoinSelectQuery

public static SQLStatementBuilder.SQLStatement createJoinSelectQuery(java.lang.String mainTable,
                                                                     java.lang.String secondaryTable,
                                                                     java.util.Vector mainKeys,
                                                                     java.util.Vector secondaryKeys,
                                                                     java.util.Vector mainTableRequestedColumns,
                                                                     java.util.Vector secondaryTableRequestedColumns,
                                                                     java.util.Hashtable mainTableConditions,
                                                                     java.util.Hashtable secondaryTableConditions,
                                                                     java.util.Vector wildcards,
                                                                     java.util.Vector columnSorting,
                                                                     boolean forceDistinct,
                                                                     boolean descending)
Returns a SQLStatement class that stores the information needed to execute a select query against two table used a join.

Parameters:
mainTable - name of the principal table the query is executed against
secondaryTable - name of the secondary table the query is executed against
mainKeys - a Vector specifying the column names of the principal table that be used to combine the two tables
secondaryKeys - a Vector specifying the column names of the secondary table that be used to combine the two tables
mainTableRequestedColumns - column list that be requested in the query from principal table
secondaryTableRequestedColumns - column list that be requested in the query from secondary table
mainTableConditions - a Hashtable specifying conditions that must comply the set of records returned from principal table
secondaryTableConditions - a Hashtable specifying conditions that must comply the set of records returned from secondary table
wildcards - column list which wildcards can be used in
columnSorting - column list where query sorting is established
forceDistinct - true if query result cannot have duplicated records
descending - true if sorting should be descending
Returns:
a SQLStatement class which stores the SQL Statement and the required values

getQueryConditionsProcessor

public static SQLStatementBuilder.SQLConditionValuesProcessor getQueryConditionsProcessor()
Returns a instance of SQLConditionValuesProcessor that be used in this class to create the condition string

Returns:
a SQLConditionValuesProcessor class

createQueryConditionsWithoutWhere

public static java.lang.String createQueryConditionsWithoutWhere(java.util.Hashtable conditions,
                                                                 java.util.Vector wildcard,
                                                                 java.util.Vector values)

Ontimize