Class SQLSelectStatement.SQLSelectStatementBuilder
java.lang.Object
com.github.tadukoo.database.mysql.syntax.statement.SQLSelectStatement.SQLSelectStatementBuilder
- All Implemented Interfaces:
SQLSelectStatement.Build,SQLSelectStatement.ColumnsOrTables,SQLSelectStatement.DistinctOrColumnsOrTables,SQLSelectStatement.FromTables,SQLSelectStatement.WhereStatementAndBuild
- Enclosing class:
- SQLSelectStatement
public static class SQLSelectStatement.SQLSelectStatementBuilder
extends Object
implements SQLSelectStatement.DistinctOrColumnsOrTables, SQLSelectStatement.ColumnsOrTables, SQLSelectStatement.FromTables, SQLSelectStatement.WhereStatementAndBuild, SQLSelectStatement.Build
A builder to build a
SQLSelectStatement. It takes the following parameters:
| Parameter | Description | Required or Default |
|---|---|---|
| distinct | Whether to select distinct columns or not | Defaults to false |
| returnColumns | The columns to be selected | Defaults to an empty list (will select all then) |
| fromTables | The tables to grab data from | Required |
| whereStatement | The conditional where statement | Defaults to null |
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether to select distinct columns or notThe tables to grab data fromThe columns to be selectedprivate ConditionalThe conditional where statement -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateNot allowed to instantiate outside SQLSelectStatement -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newSQLSelectStatementusing the set parametersprivate voidChecks for any errors with the set parametersdistinct()Sets distinct to true for this select statementfromTables(TableRef... fromTables) fromTables(List<TableRef> fromTables) returnColumns(ColumnRef... returnColumns) returnColumns(List<ColumnRef> returnColumns) whereStatement(Conditional whereStatement)
-
Field Details
-
distinct
private boolean distinctWhether to select distinct columns or not -
returnColumns
The columns to be selected -
fromTables
The tables to grab data from -
whereStatement
The conditional where statement
-
-
Constructor Details
-
SQLSelectStatementBuilder
private SQLSelectStatementBuilder()Not allowed to instantiate outside SQLSelectStatement
-
-
Method Details
-
distinct
Sets distinct to true for this select statement- Specified by:
distinctin interfaceSQLSelectStatement.DistinctOrColumnsOrTables- Returns:
- this, to continue building
-
returnColumns
- Specified by:
returnColumnsin interfaceSQLSelectStatement.ColumnsOrTables- Parameters:
returnColumns- The columns to be selected- Returns:
- this, to continue building
-
returnColumns
- Specified by:
returnColumnsin interfaceSQLSelectStatement.ColumnsOrTables- Parameters:
returnColumns- The columns to be selected- Returns:
- this, to continue building
-
fromTables
- Specified by:
fromTablesin interfaceSQLSelectStatement.FromTables- Parameters:
fromTables- The tables to grab data from- Returns:
- this, to continue building
-
fromTables
- Specified by:
fromTablesin interfaceSQLSelectStatement.FromTables- Parameters:
fromTables- The tables to grab data from- Returns:
- this, to continue building
-
whereStatement
- Specified by:
whereStatementin interfaceSQLSelectStatement.WhereStatementAndBuild- Parameters:
whereStatement- The conditional where statement- Returns:
- this, to continue building
-
checkForErrors
private void checkForErrors()Checks for any errors with the set parameters -
build
Builds a newSQLSelectStatementusing the set parameters- Specified by:
buildin interfaceSQLSelectStatement.Build- Returns:
- The newly built
SQLSelectStatement
-