public class QueryDetails extends Object implements DBQueryable
Support DBvolution at Patreon
| Constructor and Description |
|---|
QueryDetails() |
| Modifier and Type | Method and Description |
|---|---|
void |
addToSortOrder(ColumnProvider[] sortColumns) |
void |
blankResults() |
void |
clear() |
void |
clearResults() |
void |
clearSortOrder() |
protected void |
fillResultSetFromSQL(DBDatabase db,
QueryDetails details,
DBDefinition defn,
String sqlString) |
protected void |
fillResultSetInternal(DBDatabase db,
QueryDetails details,
QueryOptions options) |
List<BooleanExpression> |
getAllConditions()
Get all conditions involved in this query.
|
List<DBRow> |
getAllQueryTables()
Support DBvolution at Patreon |
List<DBQueryRow> |
getAllRows() |
void |
getAllRowsForPage(DBDatabase database,
QueryDetails details) |
String |
getANSIJoinClause(DBDefinition defn,
QueryState queryState,
DBRow newTable,
List<DBRow> previousTables,
QueryOptions options) |
List<DBRow> |
getAssumedQueryTables()
Support DBvolution at Patreon |
List<BooleanExpression> |
getConditions()
Support DBvolution at Patreon |
Long |
getCount() |
List<DBQueryRow> |
getCurrentPage() |
Map<Object,DBExpression> |
getDBReportGroupByColumns()
Support DBvolution at Patreon |
Map<Class<?>,Map<String,DBRow>> |
getExistingInstances()
Support DBvolution at Patreon |
Map<Object,QueryableDatatype<?>> |
getExpressionColumns()
Support DBvolution at Patreon |
List<DBRow> |
getExtraExamples()
Support DBvolution at Patreon |
BooleanExpression[] |
getHavingColumns()
Support DBvolution at Patreon |
List<DBRow> |
getOptionalQueryTables()
Support DBvolution at Patreon |
QueryOptions |
getOptions()
Support DBvolution at Patreon |
protected DBRow |
getOrSetExistingInstanceForRow(DBDefinition defn,
DBRow newInstance,
Map<String,DBRow> existingInstancesOfThisTableRow)
Retrieves or sets the existing instance of the DBRow provided.
|
String |
getRawSQLClause() |
<R extends DBRow> |
getRelatedInstancesFromQuery(DBRow row,
R example)
Finds all instances of
example that share a DBQueryRow with
this instance. |
List<DBRow> |
getRequiredQueryTables()
Support DBvolution at Patreon |
List<DBQueryRow> |
getResults() |
protected ResultSet |
getResultSetForSQL(DBStatement statement,
String sql)
Executes the query using the statement provided and returns the ResultSet
|
Integer |
getResultsPageIndex() |
String |
getResultSQL() |
Integer |
getResultsRowLimit() |
String |
getSelectSQLClause()
Get the SELECT clause used during the query.
|
String |
getSQLForQuery(DBDatabase database,
QueryState queryState,
QueryType queryType,
QueryOptions options) |
Integer |
getTimeoutInMilliseconds() |
boolean |
isGroupedQuery()
Return the requirement for a GROUP BY clause.
|
boolean |
needsResults(QueryOptions options) |
DBQueryable |
query(DBDatabase db)
Performs the DB query and returns a list of all actions performed in the
process.
|
protected void |
setCurrentPage(List<DBQueryRow> results) |
void |
setDefinition(DBDefinition database) |
protected Map<String,DBRow> |
setExistingInstancesForTable(Map<String,DBRow> existingInstancesOfThisTableRow,
DBRow newInstance)
Creates the list of already created rows for the DBRow class supplied.
|
protected void |
setFieldsFromColumns(DBDefinition defn,
DBRow oldInstance,
DBRow newInstance,
ResultSet resultSet)
Based on the template provided by oldInstance, fill all the fields of
newInstance with data from the current row of the ResultSet.
|
void |
setGroupByRequiredByAggregator(boolean b)
Set the requirement for a GROUP BY clause.
|
void |
setHavingColumns(BooleanExpression... havingColumns) |
void |
setOptions(QueryOptions tempOptions) |
void |
setQueryRowFromResultSet(DBDefinition defn,
ResultSet resultSet,
QueryDetails details,
DBQueryRow queryRow,
boolean isGroupedQuery) |
void |
setQueryType(QueryType queryType) |
void |
setRawSQLClause(String rawSQLClause) |
void |
setResults(List<DBQueryRow> results) |
void |
setResultsPageIndex(Integer resultsPageIndex) |
void |
setResultSQL(String resultSQL) |
void |
setResultsRowLimit(Integer resultsRowLimit) |
void |
setSelectSQLClause(String selectClause)
Define the SELECT clause used during the query.
|
void |
setSortOrder(ColumnProvider[] sortColumns) |
void |
setTimeoutInMilliseconds(Integer milliseconds) |
String |
toSQLString(DBDatabase db) |
boolean |
willCreateBlankQuery(DBDatabase db) |
public List<DBRow> getAllQueryTables()
Support DBvolution at Patreon
public List<DBRow> getRequiredQueryTables()
Support DBvolution at Patreon
public List<DBRow> getOptionalQueryTables()
Support DBvolution at Patreon
public List<DBRow> getAssumedQueryTables()
Support DBvolution at Patreon
public QueryOptions getOptions()
Support DBvolution at Patreon
public List<DBRow> getExtraExamples()
Support DBvolution at Patreon
public List<BooleanExpression> getAllConditions()
Support DBvolution at Patreon
public List<BooleanExpression> getConditions()
Support DBvolution at Patreon
public Map<Object,QueryableDatatype<?>> getExpressionColumns()
Support DBvolution at Patreon
public Map<Object,DBExpression> getDBReportGroupByColumns()
Support DBvolution at Patreon
public Map<Class<?>,Map<String,DBRow>> getExistingInstances()
Support DBvolution at Patreon
public void setGroupByRequiredByAggregator(boolean b)
b - public boolean isGroupedQuery()
Support DBvolution at Patreon
public void setSelectSQLClause(String selectClause)
selectClause - public String getSelectSQLClause()
Support DBvolution at Patreon
public BooleanExpression[] getHavingColumns()
Support DBvolution at Patreon
public void setHavingColumns(BooleanExpression... havingColumns)
havingColumns - the havingColumns to setpublic void setDefinition(DBDefinition database)
public void setQueryType(QueryType queryType)
public void setOptions(QueryOptions tempOptions)
public String getRawSQLClause()
public void setRawSQLClause(String rawSQLClause)
rawSQLClause - the rawSQLClause to setpublic List<DBQueryRow> getResults()
public void setResults(List<DBQueryRow> results)
results - the results to setpublic String getResultSQL()
public void setResultSQL(String resultSQL)
resultSQL - the resultSQL to setpublic Integer getResultsPageIndex()
public void setResultsPageIndex(Integer resultsPageIndex)
resultsPageIndex - the resultsPageIndex to setpublic Integer getResultsRowLimit()
public void setResultsRowLimit(Integer resultsRowLimit)
resultsRowLimit - the resultsRowLimit to setpublic void clearResults()
public Long getCount()
public String getSQLForQuery(DBDatabase database, QueryState queryState, QueryType queryType, QueryOptions options)
public String getANSIJoinClause(DBDefinition defn, QueryState queryState, DBRow newTable, List<DBRow> previousTables, QueryOptions options)
public void setSortOrder(ColumnProvider[] sortColumns)
public void blankResults()
public void addToSortOrder(ColumnProvider[] sortColumns)
public void clearSortOrder()
public boolean needsResults(QueryOptions options)
public List<DBQueryRow> getAllRows() throws SQLException, SQLTimeoutException, AccidentalBlankQueryException, AccidentalCartesianJoinException
getAllRows in interface DBQueryableSQLExceptionSQLTimeoutExceptionAccidentalBlankQueryExceptionAccidentalCartesianJoinExceptionpublic DBQueryable query(DBDatabase db) throws SQLException
DBQueryableThe supplied row will be changed by the action in an appropriate way, however the Action will contain an unchanged and unchangeable copy of the row for internal use.
query in interface DBQueryabledb - the target database.
Support DBvolution at Patreon
SQLException - Database operations may throw SQLExceptionspublic void getAllRowsForPage(DBDatabase database, QueryDetails details) throws SQLException
SQLExceptionprotected void fillResultSetInternal(DBDatabase db, QueryDetails details, QueryOptions options) throws SQLException
SQLExceptionprotected void fillResultSetFromSQL(DBDatabase db, QueryDetails details, DBDefinition defn, String sqlString) throws SQLException
SQLExceptionpublic <R extends DBRow> List<R> getRelatedInstancesFromQuery(DBRow row, R example) throws SQLException
example that share a DBQueryRow with
this instance.R - DBRowrow - example - example
Support DBvolution at Patreon
example that are connected to this
instance in the query 1 Database exceptions may be thrownSQLException - java.sql.SQLExceptionpublic boolean willCreateBlankQuery(DBDatabase db)
protected ResultSet getResultSetForSQL(DBStatement statement, String sql) throws SQLException, SQLTimeoutException
statement - dbStatementsql - sql
Support DBvolution at Patreon
SQLException - java.sql.SQLExceptionSQLTimeoutExceptionpublic void setQueryRowFromResultSet(DBDefinition defn, ResultSet resultSet, QueryDetails details, DBQueryRow queryRow, boolean isGroupedQuery) throws SQLException
SQLExceptionprotected void setFieldsFromColumns(DBDefinition defn, DBRow oldInstance, DBRow newInstance, ResultSet resultSet) throws SQLException
OldInstance is used to find the selected properties, newInstance is the result, and restultSet contains the retrieved data. Database exceptions may be thrown
defn - oldInstance - oldInstancenewInstance - newInstanceresultSet - resultSetSQLException - java.sql.SQLExceptionprotected Map<String,DBRow> setExistingInstancesForTable(Map<String,DBRow> existingInstancesOfThisTableRow, DBRow newInstance)
existingInstancesOfThisTableRow - existingInstancesOfThisTableRownewInstance - newInstance
Support DBvolution at Patreon
protected DBRow getOrSetExistingInstanceForRow(DBDefinition defn, DBRow newInstance, Map<String,DBRow> existingInstancesOfThisTableRow)
Queries maintain a list of existing rows to avoid duplicating identical rows. This method checks to see if the supplied row already exists and returns the existing version.
If the row is new then this method stores it, and returns it as the existing instance.
defn - newInstance - newInstanceexistingInstancesOfThisTableRow - existingInstancesOfThisTableRow
Support DBvolution at Patreon
protected void setCurrentPage(List<DBQueryRow> results)
public List<DBQueryRow> getCurrentPage()
public void clear()
public void setTimeoutInMilliseconds(Integer milliseconds)
public Integer getTimeoutInMilliseconds()
public String toSQLString(DBDatabase db)
toSQLString in interface DBQueryableCopyright © 2018. All Rights Reserved.