|
Ontimize 5.2072EN | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ontimize.db.SQLStatementBuilder
The SQLStatementBuilder class builds SQL statements
This class is used by every entity to build the SQL Statements needed to query the database.
| 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 |
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 |
public static final java.lang.String DEFAULT_HANDLER
public static final java.lang.String POSTGRES_HANDLER
public static final java.lang.String SQLSERVER_HANDLER
public static final java.lang.String ORACLE_HANDLER
public static final java.lang.String HSQLDB_HANDLER
public static final java.lang.String ACCESS_HANDLER
public static final java.lang.String MYSQL_HANDLER
protected static final java.util.Hashtable registerHandlers
public static boolean useAsInSubqueries
DefaultSQLStatementHandler.useAsInSubqueriespublic static boolean DEBUG
public static final java.lang.String SELECT
public static final java.lang.String DISTINCT
public static final java.lang.String WHERE
public static final java.lang.String FROM
public static final java.lang.String LIKE
public static final java.lang.String NOT_LIKE
public static final java.lang.String AND
public static final java.lang.String OR
public static final java.lang.String IN
public static final java.lang.String COMMA
public static final java.lang.String QUESTIONMARK
public static final java.lang.String OPEN_PARENTHESIS
public static final java.lang.String CLOSE_PARENTHESIS
public static boolean checkParenthesis
public static final java.lang.String ASTERISK
public static final java.lang.String OPEN_SQUARE_BRACKET
public static final java.lang.String CLOSE_SQUARE_BRACKET
public static final java.lang.String EQUAL_XQUESTIONMARK
public static final java.lang.String NOT_EQUAL_XQUESTIONMARK
public static final java.lang.String EQUAL
public static final java.lang.String NOT_EQUAL
public static final java.lang.String NOT_EQUAL_ID
public static final java.lang.String IS_NULL
public static final java.lang.String NULL
public static final java.lang.String MORE_EQUAL
public static final java.lang.String LESS_EQUAL
public static final java.lang.String MORE_EQUAL_XQUESTIONMARK
public static final java.lang.String LESS_EQUAL_XQUESTIONMARK
public static final java.lang.String LESS_XQUESTIONMARK
public static final java.lang.String MORE_XQUESTIONMARK
public static final java.lang.String COUNT_COLUMN_NAME
public static final java.lang.String COUNT
public static final java.lang.String TOP
public static final java.lang.String ORDER_BY
public static final java.lang.String DESC
public static final java.lang.String INSERT_INTO
public static final java.lang.String VALUES
public static final java.lang.String DELETE_FROM
public static final java.lang.String UPDATE
public static final java.lang.String SET
public static final java.lang.String SPACE
public static char ASTERISK_CHAR
public static char INTERROG
public static char PERCENT
public static char LOW_LINE
| Constructor Detail |
public SQLStatementBuilder()
| Method Detail |
public static SQLStatementHandler getSQLStatementHandler(java.lang.String handlerID)
public static void registerSQLStatementHandler(java.lang.String handlerID,
SQLStatementHandler handler)
public static boolean isUseAsInSubqueries()
public static void setUseAsInSubqueries(boolean useAsInSubqueries)
public static void setSQLConditionValuesProcessor(SQLStatementBuilder.SQLConditionValuesProcessor processor)
SQLConditionValuesProcessor to be used in SQLStatementBuilder
- Parameters:
processor - the SQLConditionValuesProcessor instance that be used
public static SQLStatementBuilder.SQLStatement createCountQuery(java.lang.String table,
java.util.Hashtable conditions,
java.util.Vector wildcards)
SQLStatement class that stores the information
needed to execute a query that obtains the number of query records
table - name of the table the query is executed againstconditions - condition list used in the querywildcards - column list that can use wildcards
SQLStatement class
public static SQLStatementBuilder.SQLStatement createSelectQuery(java.lang.String table,
java.util.Vector requestedColumns,
java.util.Hashtable conditions,
java.util.Vector wildcards)
SQLStatement class that stores the information
needed to execute a select query.
table - name of the table the query is executed againstrequestedColumns - a Vector specifying the requested column name in the queryconditions - condition list used to created the querywildcards -
SQLStatement classSQLStatementBuilder.SQLStatement
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)
SQLStatement class that stores the information
needed to execute a select query.
table - name of the table the query is executed againstrequestedColumns - a Vector specifying the requested column name in the queryconditions - condition list used to created the querywildcards - column list that can use wildcardscolumnSorting - column list where query sorting is establishedrecordCount - number of records requested in the query
SQLStatement classSQLStatementBuilder.SQLStatement
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)
SQLStatement class that stores the information
needed to execute a select query.
table - name of the table the query is executed againstrequestedColumns - a Vector specifying the requested column name in the queryconditions - condition list used to created the querywildcards - column list that can use wildcardscolumnSorting - column list where query sorting is establishedrecordCount - number of records requested in the querydescending - true if sorting should be descending
SQLStatement classSQLStatementBuilder.SQLStatement
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)
SQLStatement class that stores the information
needed to execute a select query.
table - name of the table the query is executed againstrequestedColumns - a Vector specifying the requested column name in the queryconditions - condition list used to created the querywildcards - column list that can use wildcardscolumnSorting - column list where query sorting is establishedrecordCount - number of records requested in the queryforceDistinct - true if query result cannot have duplicated recordsdescending - true if sorting should be descending
SQLStatement classSQLStatementBuilder.SQLStatement
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)
SQLStatement class that stores the information
needed to execute a select query.
table - name of the table the query is executed againstrequestedColumns - a Vector specifying the requested column name in the queryconditions - condition list used to created the querywildcards - column list that can use wildcardscolumnSorting - column list where query sorting is established
SQLStatement classSQLStatementBuilder.SQLStatement
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)
SQLStatement class that stores the information
needed to execute a select query.
table - name of the table the query is executed againstrequestedColumns - a Vector specifying the requested column name in the queryconditions - condition list used to created the querywildcards - column list that can use wildcardscolumnSorting - column list where query sorting is establisheddescending - true if sorting should be descending
SQLStatement classSQLStatementBuilder.SQLStatement
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)
SQLStatement class that stores the information
needed to execute a select query.
table - name of the table the query is executed againstrequestedColumns - a Vector specifying the requested column name in the queryconditions - condition list used to created the querywildcards - column list that can use wildcardscolumnSorting - column list where query sorting is establishedforceDistinct - true if query result cannot have duplicated recordsdescending - true if sorting should be descending
SQLStatement classSQLStatementBuilder.SQLStatementpublic static void setSQLNameEval(SQLStatementBuilder.SQLNameEval eval)
public static SQLStatementBuilder.SQLNameEval getSQLNameEval()
public static SQLStatementBuilder.SQLStatement createInsertQuery(java.lang.String table,
java.util.Hashtable attributes)
SQLStatement class that stores the information
needed to execute a insert query.
table - name of the table the query is executed againstattributes - 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.
public static SQLStatementBuilder.SQLStatement createUpdateQuery(java.lang.String table,
java.util.Hashtable attributesValues,
java.util.Hashtable keysValues)
SQLStatement class that stores the information
needed to execute a update query.
table - name of the table the update is executed againstattributesValues - 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.
SQLStatementBuilder.SQLStatement
public static SQLStatementBuilder.SQLStatement createDeleteQuery(java.lang.String table,
java.util.Hashtable keysValues)
SQLStatement class that stores the information
needed to execute a delete query.
table - name of the table the query is executed againstkeysValues - 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.
public static void addSpecialCharacters(char[] c)
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.
c - a array with the new characters
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)
SQLStatement class that stores the information
needed to execute a select query against two table used a join.
principalTable - name of the principal table the query is executed againstsecondaryTable - name of the secondary table the query is executed againstprincipalKeys - a Vector specifying the column names of the principal table that
be used to combine the two tablessecondaryKeys - a Vector specifying the column names of the secondary table that
be used to combine the two tablesprincipalTableRequestedColumns - column list that be requested in the query from principal tablesecondaryTableRequestedColumns - column list that be requested in the query from secondary tableprincipalTableConditions - a Hashtable specifying conditions that must comply the set of
records returned from principal tablesecondaryTableConditions - a Hashtable specifying conditions that must comply the set of
records returned from secondary tablewildcards - column list which wildcards can be used incolumnSorting - column list where query sorting is establishedforceDistinct - true if query result cannot have duplicated records
SQLStatement class which stores the SQL Statement
and the required values
public static java.lang.String qualify(java.lang.String col,
java.lang.String table)
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]
col - a String with the column nametable - a String with the table name
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)
SQLStatement class that stores the information
needed to execute a select query against two table used a join.
mainTable - name of the principal table the query is executed againstsecondaryTable - name of the secondary table the query is executed againstmainKeys - a Vector specifying the column names of the principal table that
be used to combine the two tablessecondaryKeys - a Vector specifying the column names of the secondary table that
be used to combine the two tablesmainTableRequestedColumns - column list that be requested in the query from principal tablesecondaryTableRequestedColumns - column list that be requested in the query from secondary tablemainTableConditions - a Hashtable specifying conditions that must comply the set of
records returned from principal tablesecondaryTableConditions - a Hashtable specifying conditions that must comply the set of
records returned from secondary tablewildcards - column list which wildcards can be used incolumnSorting - column list where query sorting is establishedforceDistinct - true if query result cannot have duplicated recordsdescending - true if sorting should be descending
SQLStatement class which stores the SQL Statement
and the required valuespublic static SQLStatementBuilder.SQLConditionValuesProcessor getQueryConditionsProcessor()
SQLConditionValuesProcessor that be
used in this class to create the condition string
SQLConditionValuesProcessor class
public static java.lang.String createQueryConditionsWithoutWhere(java.util.Hashtable conditions,
java.util.Vector wildcard,
java.util.Vector values)
|
Ontimize | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||