public class DatabaseQueryBuilder extends Object
The main functionality of this helper class is create SQL query statement with bundled object references
Modifier and Type | Class and Description |
---|---|
static class |
DatabaseQueryBuilder.OrderBy
The Required order by data subclass.
|
Constructor and Description |
---|
DatabaseQueryBuilder(String selectFrom)
DatabaseQuery Constructor which takes advantage of prepared selectFrom
SQL clause.
|
DatabaseQueryBuilder(String tableName,
Set<String> columns)
DatabaseQuery Constructor, construct selectFrom from table name, columns
and where clause.
|
Modifier and Type | Method and Description |
---|---|
List<SQLParam> |
getParams()
Values in wrapped object.
|
String |
getSQL()
Return full sql statement string.
|
void |
setColumns(Set<String> columns)
Set the columnNames to get.
|
void |
setOrderBy(List<DatabaseQueryBuilder.OrderBy> orderBy)
Set the order by clause.
|
void |
setSelectFrom(String selectFrom)
Set selectFrom and from clause.
|
void |
setTableName(String tableName)
Set the table name.
|
void |
setWhere(FilterWhereBuilder whereBuilder)
set the where builder.
|
public DatabaseQueryBuilder(String tableName, Set<String> columns)
tableName
- The name of the database table to selectFrom fromcolumns
- the names of the column to be in the resultpublic DatabaseQueryBuilder(String selectFrom)
selectFrom
- mandatory selectFrom clausepublic void setColumns(Set<String> columns)
columns
- the required columns in SQL querypublic void setSelectFrom(String selectFrom)
selectFrom
- the selectFrom part including the from tablepublic void setTableName(String tableName)
tableName
- name of the tablepublic void setWhere(FilterWhereBuilder whereBuilder)
whereBuilder
- FilterWhereBuilder
the where filer builderpublic void setOrderBy(List<DatabaseQueryBuilder.OrderBy> orderBy)
orderBy
- a list of Pair
pair as columnName and sort orderpublic String getSQL()
Copyright © 2018–2025. All rights reserved.