public class DefaultSQLStatementHandler extends Object implements SQLStatementHandler
| Modifier and Type | Field and Description |
|---|---|
protected char[] |
CONFLICT_CHARS |
protected SQLStatementBuilder.SQLConditionValuesProcessor |
queryConditionsProcessor |
protected SQLStatementBuilder.SQLNameEval |
sqlNameEval |
boolean |
useAsInSubqueries |
| Constructor and Description |
|---|
DefaultSQLStatementHandler() |
| Modifier and Type | Method and Description |
|---|---|
String |
addInnerMultilanguageColumns(String subSqlQuery,
Vector attributes,
Hashtable hLocaleTablesAV) |
String |
addMultilanguageLeftJoinTables(String table,
Vector tables,
LinkedHashMap keys,
LocalePair localeId) |
String |
addOuterMultilanguageColumns(String sqlQuery,
String table,
Hashtable hLocaleTablesAV) |
String |
addOuterMultilanguageColumnsPageable(String sqlQuery,
String table,
Hashtable hLocaleTablesAV) |
void |
addSpecialCharacters(char[] c)
Adds characters to the list of special characters.
|
protected void |
changeColumnName(EntityResult result,
String nameColumn,
String replaceByColumn) |
protected void |
changeColumnNames(EntityResult result,
List columnNames) |
protected void |
changeGenerateKeyNames(EntityResult result,
List columnNames) |
boolean |
checkColumnName(String columnName)
Returns true if square brackets are necessary insert in this column name.
|
protected String |
createCountQuery(String table) |
SQLStatementBuilder.SQLStatement |
createCountQuery(String table,
Hashtable conditions,
Vector wildcards,
Vector countColumns)
Returns a
SQLStatement class that stores the information
needed to execute a query that obtains the number of query records |
protected String |
createCountQuery(String table,
Vector countColumns)
Builds a count query using a column name.
|
SQLStatementBuilder.SQLStatement |
createDeleteQuery(String table,
Hashtable keysValues)
Returns a
SQLStatement class that stores the information
needed to execute a delete query. |
SQLStatementBuilder.SQLStatement |
createInsertQuery(String table,
Hashtable attributes)
Returns a
SQLStatement class that stores the information
needed to execute a insert query. |
SQLStatementBuilder.SQLStatement |
createJoinFromSubselectsQuery(String primaryAlias,
String secondaryAlias,
String primaryQuery,
String secondaryQuery,
Vector primaryKeys,
Vector secondaryKeys,
Vector primaryTableRequestedColumns,
Vector secondaryTableRequestedColumns,
Hashtable primaryTableConditions,
Hashtable secondaryTableConditions,
Vector wildcards,
Vector columnSorting,
boolean forceDistinct,
boolean descending)
Returns a
SQLStatement class that stores the information
needed to execute a select query against two subselects used a join. |
SQLStatementBuilder.SQLStatement |
createJoinSelectQuery(String principalTable,
String secondaryTable,
Vector principalKeys,
Vector secondaryKeys,
Vector principalTableRequestedColumns,
Vector secondaryTableRequestedColumns,
Hashtable principalTableConditions,
Hashtable secondaryTableConditions,
Vector wildcards,
Vector columnSorting,
boolean forceDistinct)
This class provides a implementation of the
SQLConditionValuesProcessor interface. |
SQLStatementBuilder.SQLStatement |
createJoinSelectQuery(String mainTable,
String secondaryTable,
Vector mainKeys,
Vector secondaryKeys,
Vector mainTableRequestedColumns,
Vector secondaryTableRequestedColumns,
Hashtable mainTableConditions,
Hashtable secondaryTableConditions,
Vector wildcards,
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. |
SQLStatementBuilder.SQLStatement |
createLeftJoinSelectQuery(String mainTable,
String subquery,
String secondaryTable,
Vector mainKeys,
Vector secondaryKeys,
Vector mainTableRequestedColumns,
Vector secondaryTableRequestedColumns,
Hashtable mainTableConditions,
Hashtable secondaryTableConditions,
Vector wildcards,
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 left join. |
protected SQLStatementBuilder.SQLStatement |
createLeftJoinSelectQueryPageable(String mainTable,
String subquery,
String secondaryTable,
Vector mainKeys,
Vector secondaryKeys,
Vector mainTableRequestedColumns,
Vector secondaryTableRequestedColumns,
Hashtable mainTableConditions,
Hashtable secondaryTableConditions,
Vector wildcards,
Vector columnSorting,
boolean forceDistinct,
boolean descending,
int i) |
SQLStatementBuilder.SQLStatement |
createLeftJoinSelectQueryPageable(String mainTable,
String subquery,
String secondaryTable,
Vector mainKeys,
Vector secondaryKeys,
Vector mainTableRequestedColumns,
Vector secondaryTableRequestedColumns,
Hashtable mainTableConditions,
Hashtable secondaryTableConditions,
Vector wildcards,
Vector columnSorting,
boolean forceDistinct,
boolean descending,
int recordNumber,
int startIndex)
Returns a
SQLStatement class that stores the information
needed to execute a select query against two subselects used a join. |
protected String |
createQueryConditions(Hashtable conditions,
Vector wildcard,
Vector values)
Returns the condition string for a SQL Statement.
|
protected String |
createQueryConditions(Hashtable conditions,
Vector wildcardColumns,
Vector values,
boolean withWhere) |
String |
createQueryConditionsWithoutWhere(Hashtable conditions,
Vector wildcard,
Vector values)
Returns the condition string for a SQL Statement without WHERE clause in
SQL.
|
protected String |
createSelectClause(boolean forceDistinct) |
protected String |
createSelectQuery(String table,
Vector askedColumns) |
protected String |
createSelectQuery(String table,
Vector askedColumns,
boolean forceDistinct) |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards)
Returns a
SQLStatement class that stores the information
needed to execute a select query. |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards,
Vector columnSorting)
Returns a
SQLStatement class that stores the information
needed to execute a select query. |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards,
Vector columnSorting,
boolean descending)
Returns a
SQLStatement class that stores the information
needed to execute a select query. |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards,
Vector columnSorting,
boolean descending,
boolean forceDistinct)
Returns a
SQLStatement class that stores the information
needed to execute a select query. |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards,
Vector columnSorting,
int recordCount)
Returns a
SQLStatement class that stores the information
needed to execute a select query. |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards,
Vector columnSorting,
int recordCount,
boolean descending)
Returns a
SQLStatement class that stores the information
needed to execute a select query. |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards,
Vector columnSorting,
int recordCount,
boolean descending,
boolean forceDistinct)
Returns a
SQLStatement class that stores the information
needed to execute a select query. |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards,
Vector columnSorting,
int recordCount,
int offset) |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards,
Vector columnSorting,
int recordCount,
int offset,
boolean descending) |
SQLStatementBuilder.SQLStatement |
createSelectQuery(String table,
Vector requestedColumns,
Hashtable conditions,
Vector wildcards,
Vector columnSorting,
int recordCount,
int offset,
boolean descending,
boolean forceDistinct) |
protected String |
createSortStatement(Vector sortColumns) |
protected String |
createSortStatement(Vector sortColumns,
boolean descending) |
SQLStatementBuilder.SQLStatement |
createUpdateQuery(String table,
Hashtable attributesValues,
Hashtable keysValues)
Returns a
SQLStatement class that stores the information
needed to execute a update query. |
void |
generatedKeysToEntityResult(ResultSet resultSet,
EntityResult entityResult,
List generatedKeys) |
protected String[] |
getColumnNames(ResultSetMetaData rsMetaData) |
SQLStatementBuilder.SQLConditionValuesProcessor |
getQueryConditionsProcessor()
Returns a instance of
SQLConditionValuesProcessor that be
used in this class to create the condition string |
protected Object |
getResultSetValue(ResultSet resultSet,
String columnName,
int columnType) |
SQLStatementBuilder.SQLNameEval |
getSQLNameEval() |
protected DBFunctionName |
hasIsolationFunction(Vector requestedColumns) |
boolean |
isDelimited() |
boolean |
isPageable() |
boolean |
isUseAsInSubqueries() |
String |
qualify(String col,
String table)
Returns a
String with the qualified name. |
protected Object |
readBinaryStream(InputStream in)
Reads an array of bytes from the stream
in. |
protected Object |
readCharacterStream(InputStream in)
Returns a String containing the characters read from the stream
in. |
protected Object |
readCharacterStream(Reader in)
Returns a String containing the characters read from the reader
in. |
void |
resultSetToEntityResult(ResultSet resultSet,
EntityResult entityResult,
int recordNumber,
int offset,
boolean delimited,
List columnNames)
Transforms a java.sql.ResultSet object into an Ontimize
EntityResult. |
void |
resultSetToEntityResult(ResultSet resultSet,
EntityResult entityResult,
List columnNames) |
void |
setObject(int index,
Object value,
PreparedStatement preparedStatement,
boolean truncDates)
Sets a parameter value in a prepared statement, at index
index
The methods used are:
setBlob for Blob objects
setClob for Clob objects
setBinaryStream for BytesBlock objects
setCharacterStream for com.ontimize.gui.LongString
setNull for com.ontimize.db.NullValue
setObject for all other object
|
void |
setSQLConditionValuesProcessor(SQLStatementBuilder.SQLConditionValuesProcessor processor)
Sets the
SQLConditionValuesProcessor |
void |
setSQLNameEval(SQLStatementBuilder.SQLNameEval eval) |
protected void |
setTimestampObject(Timestamp value,
int index,
PreparedStatement preparedStatement,
boolean truncDates) |
void |
setUseAsInSubqueries(boolean useAsInSubqueries) |
protected SQLStatementBuilder.SQLConditionValuesProcessor queryConditionsProcessor
protected SQLStatementBuilder.SQLNameEval sqlNameEval
protected char[] CONFLICT_CHARS
public boolean useAsInSubqueries
public boolean isUseAsInSubqueries()
isUseAsInSubqueries in interface SQLStatementHandlerpublic void setUseAsInSubqueries(boolean useAsInSubqueries)
setUseAsInSubqueries in interface SQLStatementHandlerpublic void setSQLConditionValuesProcessor(SQLStatementBuilder.SQLConditionValuesProcessor processor)
SQLConditionValuesProcessor to be used in SQLStatementBuildersetSQLConditionValuesProcessor in interface SQLStatementHandlerprocessor - the SQLConditionValuesProcessor instance that be usedpublic SQLStatementBuilder.SQLStatement createCountQuery(String table, Hashtable conditions, Vector wildcards, Vector countColumns)
SQLStatement class that stores the information
needed to execute a query that obtains the number of query recordscreateCountQuery in interface SQLStatementHandlertable - name of the table the query is executed againstconditions - condition list used in the querywildcards - column list that can use wildcardsSQLStatement classpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards)
SQLStatement class that stores the information
needed to execute a select query.createSelectQuery in interface SQLStatementHandlertable - 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.SQLStatementpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards, Vector columnSorting, int recordCount)
SQLStatement class that stores the information
needed to execute a select query.createSelectQuery in interface SQLStatementHandlertable - 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 querySQLStatement classSQLStatementBuilder.SQLStatementpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards, Vector columnSorting, int recordCount, boolean descending)
SQLStatement class that stores the information
needed to execute a select query.createSelectQuery in interface SQLStatementHandlertable - 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 descendingSQLStatement classSQLStatementBuilder.SQLStatementpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards, Vector columnSorting, int recordCount, boolean descending, boolean forceDistinct)
SQLStatement class that stores the information
needed to execute a select query.createSelectQuery in interface SQLStatementHandlertable - 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 descendingSQLStatement classSQLStatementBuilder.SQLStatementpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards, Vector columnSorting, int recordCount, int offset)
createSelectQuery in interface SQLStatementHandlerpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards, Vector columnSorting, int recordCount, int offset, boolean descending)
createSelectQuery in interface SQLStatementHandlerpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards, Vector columnSorting, int recordCount, int offset, boolean descending, boolean forceDistinct)
createSelectQuery in interface SQLStatementHandlerpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards, Vector columnSorting)
SQLStatement class that stores the information
needed to execute a select query.createSelectQuery in interface SQLStatementHandlertable - 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 establishedSQLStatement classSQLStatementBuilder.SQLStatementpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards, Vector columnSorting, boolean descending)
SQLStatement class that stores the information
needed to execute a select query.createSelectQuery in interface SQLStatementHandlertable - 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 descendingSQLStatement classSQLStatementBuilder.SQLStatementpublic SQLStatementBuilder.SQLStatement createSelectQuery(String table, Vector requestedColumns, Hashtable conditions, Vector wildcards, Vector columnSorting, boolean descending, boolean forceDistinct)
SQLStatement class that stores the information
needed to execute a select query.createSelectQuery in interface SQLStatementHandlertable - 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 descendingSQLStatement classSQLStatementBuilder.SQLStatementprotected DBFunctionName hasIsolationFunction(Vector requestedColumns)
protected String createCountQuery(String table, Vector countColumns)
table - Database tablecountColumn - Column to perform the count operation. If this parameter is
null will be used count(*).protected String createSelectClause(boolean forceDistinct)
protected String createSelectQuery(String table, Vector askedColumns, boolean forceDistinct)
protected String createQueryConditions(Hashtable conditions, Vector wildcardColumns, Vector values, boolean withWhere)
protected String createQueryConditions(Hashtable conditions, Vector wildcard, Vector values)
conditions - condition list that be using for create the stringwildcard - column list that can use wildcardsvalues - vector where the value of each processed conditions is storedpublic String createQueryConditionsWithoutWhere(Hashtable conditions, Vector wildcard, Vector values)
createQueryConditionsWithoutWhere in interface SQLStatementHandlerconditions - condition list that be using for create the stringwildcard - column list that can use wildcardsvalues - vector where the value of each processed conditions is storedpublic void setSQLNameEval(SQLStatementBuilder.SQLNameEval eval)
setSQLNameEval in interface SQLStatementHandlerpublic SQLStatementBuilder.SQLNameEval getSQLNameEval()
getSQLNameEval in interface SQLStatementHandlerpublic boolean checkColumnName(String columnName)
If the column name has a character of the special character list, it's necessary insert column name in square brackets.
checkColumnName in interface SQLStatementHandlerpublic SQLStatementBuilder.SQLStatement createInsertQuery(String table, Hashtable attributes)
SQLStatement class that stores the information
needed to execute a insert query.createInsertQuery in interface SQLStatementHandlertable - 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 SQLStatementBuilder.SQLStatement createUpdateQuery(String table, Hashtable attributesValues, Hashtable keysValues)
SQLStatement class that stores the information
needed to execute a update query.createUpdateQuery in interface SQLStatementHandlertable - 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.SQLStatementpublic SQLStatementBuilder.SQLStatement createDeleteQuery(String table, Hashtable keysValues)
SQLStatement class that stores the information
needed to execute a delete query.createDeleteQuery in interface SQLStatementHandlertable - 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 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.
addSpecialCharacters in interface SQLStatementHandlerc - a array with the new characterspublic SQLStatementBuilder.SQLStatement createJoinSelectQuery(String principalTable, String secondaryTable, Vector principalKeys, Vector secondaryKeys, Vector principalTableRequestedColumns, Vector secondaryTableRequestedColumns, Hashtable principalTableConditions, Hashtable secondaryTableConditions, Vector wildcards, Vector columnSorting, boolean forceDistinct)
SQLConditionValuesProcessor interface.
This class extends
Using classes that implements
In the next examples the basic implementations have been used:
DefaultSQLConditionValuesProcessor and permits process complex conditions
where condition key doesn't have to be the column of a table in a database.
EXPRESSION_KEY is used as condition key to indicate which
is a complex condition
Expression, Field, Operator
interfaces is necessary to define a complex condition. Each class that
implements the Expression interface has three important
parts. The left operand that can only be another expression or a class
that implements Field interface The right operand that can
be another expression or a value The operator that has to be a class that
implement Operator interface
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);
createJoinSelectQuery in interface SQLStatementHandlerSQLStatementBuilder.Expressionpublic String qualify(String col, 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]
qualify in interface SQLStatementHandlercol - a String with the column nametable - a String with the table namepublic SQLStatementBuilder.SQLStatement createJoinSelectQuery(String mainTable, String secondaryTable, Vector mainKeys, Vector secondaryKeys, Vector mainTableRequestedColumns, Vector secondaryTableRequestedColumns, Hashtable mainTableConditions, Hashtable secondaryTableConditions, Vector wildcards, Vector columnSorting, boolean forceDistinct, boolean descending)
SQLStatement class that stores the information
needed to execute a select query against two table used a join.createJoinSelectQuery in interface SQLStatementHandlermainTable - 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 descendingSQLStatement class which stores the SQL Statement
and the required valuespublic SQLStatementBuilder.SQLStatement createJoinFromSubselectsQuery(String primaryAlias, String secondaryAlias, String primaryQuery, String secondaryQuery, Vector primaryKeys, Vector secondaryKeys, Vector primaryTableRequestedColumns, Vector secondaryTableRequestedColumns, Hashtable primaryTableConditions, Hashtable secondaryTableConditions, Vector wildcards, Vector columnSorting, boolean forceDistinct, boolean descending)
SQLStatement class that stores the information
needed to execute a select query against two subselects used a join.createJoinFromSubselectsQuery in interface SQLStatementHandlerprimaryAlias - name of the principal querysecondaryAlias - name of the secondary queryprimaryTable - principal query is executed againstsecondaryTable - secondary query is executed againstprimaryKeys - 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 tablesprimaryTableRequestedColumns - column list that be requested in the query from principal
tablesecondaryTableRequestedColumns - column list that be requested in the query from secondary
tableprimaryTableConditions - 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 descendingSQLStatement class which stores the SQL Statement
and the required valuespublic SQLStatementBuilder.SQLStatement createLeftJoinSelectQueryPageable(String mainTable, String subquery, String secondaryTable, Vector mainKeys, Vector secondaryKeys, Vector mainTableRequestedColumns, Vector secondaryTableRequestedColumns, Hashtable mainTableConditions, Hashtable secondaryTableConditions, Vector wildcards, Vector columnSorting, boolean forceDistinct, boolean descending, int recordNumber, int startIndex)
SQLStatement class that stores the information
needed to execute a select query against two subselects used a join.createLeftJoinSelectQueryPageable in interface SQLStatementHandlerprimaryAlias - name of the principal querysecondaryAlias - name of the secondary queryprimaryTable - principal query is executed againstsecondaryTable - secondary query is executed againstprimaryKeys - 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 tablesprimaryTableRequestedColumns - column list that be requested in the query from principal
tablesecondaryTableRequestedColumns - column list that be requested in the query from secondary
tableprimaryTableConditions - 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 descendingrecordNumber - number of rows to returnstartIndex - number of initial rowSQLStatement class which stores the SQL Statement
and the required valuesprotected SQLStatementBuilder.SQLStatement createLeftJoinSelectQueryPageable(String mainTable, String subquery, String secondaryTable, Vector mainKeys, Vector secondaryKeys, Vector mainTableRequestedColumns, Vector secondaryTableRequestedColumns, Hashtable mainTableConditions, Hashtable secondaryTableConditions, Vector wildcards, Vector columnSorting, boolean forceDistinct, boolean descending, int i)
public SQLStatementBuilder.SQLStatement createLeftJoinSelectQuery(String mainTable, String subquery, String secondaryTable, Vector mainKeys, Vector secondaryKeys, Vector mainTableRequestedColumns, Vector secondaryTableRequestedColumns, Hashtable mainTableConditions, Hashtable secondaryTableConditions, Vector wildcards, Vector columnSorting, boolean forceDistinct, boolean descending)
SQLStatement class that stores the information
needed to execute a select query against two table used a left join.createLeftJoinSelectQuery in interface SQLStatementHandlermainTable - name of the principal table the query is executed againstsubQuery - the subquery. If this parameter is not null, the principal
table acts as alias for the subquery, like
"FROM (SUBQUERY) MAINTABLE". If null, subquery is not
executed.subQueryValues - conditions for the subquery. Null if subquery has not
conditionssecondaryTable - 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 descendingSQLStatement class which stores the SQL Statement
and the required valuespublic SQLStatementBuilder.SQLConditionValuesProcessor getQueryConditionsProcessor()
SQLConditionValuesProcessor that be
used in this class to create the condition stringgetQueryConditionsProcessor in interface SQLStatementHandlerSQLConditionValuesProcessor classpublic boolean isPageable()
isPageable in interface SQLStatementHandlerpublic boolean isDelimited()
isDelimited in interface SQLStatementHandlerpublic void resultSetToEntityResult(ResultSet resultSet, EntityResult entityResult, List columnNames) throws Exception
resultSetToEntityResult in interface SQLStatementHandlerExceptionpublic void resultSetToEntityResult(ResultSet resultSet, EntityResult entityResult, int recordNumber, int offset, boolean delimited, List columnNames) throws Exception
EntityResult. The columns in the ResultSet are the keys in the
EntityResult, and the values for the columns are stored in Vector objects
corresponding to the keys in the EntityResult.
The following getxxxxx ResulSet methods are used for getting column data:
resultSetToEntityResult in interface SQLStatementHandlerresultSet - the source ResultSetentityResult - the destination EntityResult. It has a Hashtable of Vectors
structure.recordNumber - Number of records to queryoffset - number of the row where startdelimited - If delimited is true then all the resultSet must be queried
into the EntityResult, because the original query that
generated the ResultSet only returns the number of records
specified in recordNumber. If delimited is false
then this method only read the specified
recordNumber from the ResultSet into the
EntityResultcolumnNames - Names of the columns to return in the EntityResult. If this
parameter is null or empty then return exactly the same names
in the ResultSetException - if any error (database, etc.) occursprotected Object getResultSetValue(ResultSet resultSet, String columnName, int columnType) throws Exception
Exceptionpublic void generatedKeysToEntityResult(ResultSet resultSet, EntityResult entityResult, List generatedKeys) throws Exception
generatedKeysToEntityResult in interface SQLStatementHandlerExceptionprotected void changeGenerateKeyNames(EntityResult result, List columnNames)
protected void changeColumnNames(EntityResult result, List columnNames)
protected void changeColumnName(EntityResult result, String nameColumn, String replaceByColumn)
protected String[] getColumnNames(ResultSetMetaData rsMetaData)
rsMetaData - Database metadata. See custom implementation at
MySQLSQLStatementHandler.protected Object readCharacterStream(InputStream in)
in.
No character conversion is performed.
in - protected Object readCharacterStream(Reader in)
in.
No character conversion is performed.
in - protected Object readBinaryStream(InputStream in)
in.in - public void setObject(int index,
Object value,
PreparedStatement preparedStatement,
boolean truncDates)
throws SQLException
index
The methods used are:
setObject in interface SQLStatementHandlerindex - value - preparedStatement - truncDates - SQLExceptionprotected void setTimestampObject(Timestamp value, int index, PreparedStatement preparedStatement, boolean truncDates) throws SQLException
SQLExceptionpublic String addMultilanguageLeftJoinTables(String table, Vector tables, LinkedHashMap keys, LocalePair localeId) throws SQLException
addMultilanguageLeftJoinTables in interface SQLStatementHandlerSQLExceptionpublic String addInnerMultilanguageColumns(String subSqlQuery, Vector attributes, Hashtable hLocaleTablesAV)
addInnerMultilanguageColumns in interface SQLStatementHandlerpublic String addOuterMultilanguageColumns(String sqlQuery, String table, Hashtable hLocaleTablesAV)
addOuterMultilanguageColumns in interface SQLStatementHandlerpublic String addOuterMultilanguageColumnsPageable(String sqlQuery, String table, Hashtable hLocaleTablesAV)
addOuterMultilanguageColumnsPageable in interface SQLStatementHandlerCopyright © 2016 Imatia Innovation S.L.. All rights reserved.