Class InsertQueryBuilder
java.lang.Object
io.github.blyznytsiaorg.bibernate.dao.jdbc.dsl.QueryBuilder
io.github.blyznytsiaorg.bibernate.dao.jdbc.dsl.InsertQueryBuilder
Represents a SQL INSERT query builder for constructing INSERT statements with specified fields and values.
Extends the base class QueryBuilder.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static final record
A record representing a field to be used in an INSERT operation. -
Field Summary
Modifier and TypeFieldDescriptionprivate final List
<InsertQueryBuilder.InsertField> Represents an individual field to be inserted with its corresponding value.Fields inherited from class io.github.blyznytsiaorg.bibernate.dao.jdbc.dsl.QueryBuilder
ALL_FIELDS, AND, AS, BETWEEN_S_AND_S, CLOSE_BRACKET, COMA, DELETE, DOT, EQ, FROM, GROUP_BY, HAVING, IN, INSERT_INTO, OPEN_BRACKET, OR, PARAMETER, SELECT, SEMICOLON, SET, SPACE, tableName, UNDERSCORE, UNION, UPDATE, WHERE, whereConditions
-
Constructor Summary
ConstructorDescriptionInsertQueryBuilder
(String tableName) The list of fields to be inserted along with their values. -
Method Summary
Modifier and TypeMethodDescriptionBuilds the INSERT SQL statement based on the configured fields and values.static InsertQueryBuilder
Constructs a new InsertQueryBuilder with the specified table name.Adds a field to the list of fields to be inserted.Methods inherited from class io.github.blyznytsiaorg.bibernate.dao.jdbc.dsl.QueryBuilder
handleWhereCondition
-
Field Details
-
insertFields
Represents an individual field to be inserted with its corresponding value.
-
-
Constructor Details
-
InsertQueryBuilder
The list of fields to be inserted along with their values.
-
-
Method Details
-
from
Constructs a new InsertQueryBuilder with the specified table name.- Parameters:
tableName
- The name of the table into which records will be inserted.
-
setField
Adds a field to the list of fields to be inserted.- Parameters:
fieldName
- The name of the field to be inserted.- Returns:
- The current InsertQueryBuilder instance for method chaining.
-
buildInsertStatement
Builds the INSERT SQL statement based on the configured fields and values.- Returns:
- The generated INSERT SQL statement as a string.
- Throws:
IllegalStateException
- If no fields are specified for insert.
-