Package net.tirasa.connid.commons.db
Class DatabaseQueryBuilder
java.lang.Object
net.tirasa.connid.commons.db.DatabaseQueryBuilder
The Database Query builder creates the database query.
The main functionality of this helper class is create SQL query statement with bundled object references
- Since:
- 1.0
- Version:
- $Revision 1.0$
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The Required order by data subclass -
Constructor Summary
ConstructorDescriptionDatabaseQueryBuilder
(String selectFrom) DatabaseQuery Constructor which takes advantage of prepared selectFrom SQL clauseDatabaseQueryBuilder
(String tableName, Set<String> columns) DatabaseQuery Constructor, construct selectFrom from table name, columns and where clause -
Method Summary
Modifier and TypeMethodDescriptionValues in wrapped objectgetSQL()
Return full sql statement stringvoid
setColumns
(Set<String> columns) Set the columnNames to getvoid
setOrderBy
(List<DatabaseQueryBuilder.OrderBy> orderBy) sET THE ORDER BY CLAUSEvoid
setSelectFrom
(String selectFrom) Set selectFrom and from clausevoid
setTableName
(String tableName) Set the table namevoid
setWhere
(FilterWhereBuilder whereBuilder) set the where builder
-
Constructor Details
-
DatabaseQueryBuilder
DatabaseQuery Constructor, construct selectFrom from table name, columns and where clause- Parameters:
tableName
- The name of the database table to selectFrom fromcolumns
- the names of the column to be in the result
-
DatabaseQueryBuilder
DatabaseQuery Constructor which takes advantage of prepared selectFrom SQL clause- Parameters:
selectFrom
- mandatory selectFrom clause
-
-
Method Details
-
setColumns
Set the columnNames to get- Parameters:
columns
- the required columns in SQL query
-
setSelectFrom
Set selectFrom and from clause- Parameters:
selectFrom
- the selectFrom part including the from table
-
setTableName
Set the table name- Parameters:
tableName
- name of the table
-
setWhere
set the where builder- Parameters:
whereBuilder
-FilterWhereBuilder
the where filer builder
-
setOrderBy
sET THE ORDER BY CLAUSE- Parameters:
orderBy
- a list ofPair
pair as colunName and sort order
-
getSQL
Return full sql statement string- Returns:
- Sql query statement to execute
-
getParams
Values in wrapped object- Returns:
- the where values
-