Class SQLInsertStatement.SQLInsertStatementBuilder
java.lang.Object
com.github.tadukoo.database.mysql.syntax.statement.SQLInsertStatement.SQLInsertStatementBuilder
- All Implemented Interfaces:
SQLInsertStatement.Build
,SQLInsertStatement.ColumnsAndValuesOrSelectStatement
,SQLInsertStatement.Table
- Enclosing class:
- SQLInsertStatement
public static class SQLInsertStatement.SQLInsertStatementBuilder
extends Object
implements SQLInsertStatement.Table, SQLInsertStatement.ColumnsAndValuesOrSelectStatement, SQLInsertStatement.Build
A builder class used to build a
SQLInsertStatement
. It takes the following parameters:
Parameter | Description | Default or Required |
---|---|---|
table | The table to insert into |
Required |
columns | The columns to insert into |
Defaults to empty list |
values | The values to insert | Defaults to empty list - need either this or select statement |
selectStmt | The select statement to use for values to insert |
Defaults to null - need either this or values |
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
Modifier and TypeFieldDescriptionThecolumns
to insert intoprivate SQLSelectStatement
Theselect statement
to use for values to insertprivate TableRef
Thetable
to insert intoThe values to insert -
Constructor Summary
ModifierConstructorDescriptionprivate
Not allowed to instantiate outside SQLInsertStatement -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a newSQLInsertStatement
after checking for errorsprivate void
Checks for any errors and throws an IllegalArgumentException if any are foundselectStmt
(SQLSelectStatement selectStmt)
-
Field Details
-
table
Thetable
to insert into -
columns
Thecolumns
to insert into -
values
The values to insert -
selectStmt
Theselect statement
to use for values to insert
-
-
Constructor Details
-
SQLInsertStatementBuilder
private SQLInsertStatementBuilder()Not allowed to instantiate outside SQLInsertStatement
-
-
Method Details
-
table
- Specified by:
table
in interfaceSQLInsertStatement.Table
- Parameters:
table
- Thetable
to insert into- Returns:
- this, to continue building
-
columns
- Specified by:
columns
in interfaceSQLInsertStatement.ColumnsAndValuesOrSelectStatement
- Parameters:
columns
- Thecolumns
to insert into- Returns:
- this, to continue building
-
columns
- Specified by:
columns
in interfaceSQLInsertStatement.ColumnsAndValuesOrSelectStatement
- Parameters:
columns
- Acolumn
to insert into- Returns:
- this, to continue building
-
values
- Specified by:
values
in interfaceSQLInsertStatement.ColumnsAndValuesOrSelectStatement
- Parameters:
values
- The values to insert- Returns:
- this, to continue building
-
values
- Specified by:
values
in interfaceSQLInsertStatement.ColumnsAndValuesOrSelectStatement
- Parameters:
values
- The values to insert- Returns:
- this, to continue building
-
selectStmt
- Specified by:
selectStmt
in interfaceSQLInsertStatement.ColumnsAndValuesOrSelectStatement
- Parameters:
selectStmt
- Theselect statement
to use for values to insert- Returns:
- this, to continue building
-
checkForErrors
private void checkForErrors()Checks for any errors and throws an IllegalArgumentException if any are found -
build
Creates a newSQLInsertStatement
after checking for errors- Specified by:
build
in interfaceSQLInsertStatement.Build
- Returns:
- The newly built
SQLInsertStatement
-