Class InsertQueryBuilder

java.lang.Object
io.github.blyznytsiaorg.bibernate.dao.jdbc.dsl.QueryBuilder
io.github.blyznytsiaorg.bibernate.dao.jdbc.dsl.InsertQueryBuilder

public class InsertQueryBuilder extends QueryBuilder
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
  • Field Details

  • Constructor Details

    • InsertQueryBuilder

      public InsertQueryBuilder(String tableName)
      The list of fields to be inserted along with their values.
  • Method Details

    • from

      public static InsertQueryBuilder from(String tableName)
      Constructs a new InsertQueryBuilder with the specified table name.
      Parameters:
      tableName - The name of the table into which records will be inserted.
    • setField

      public InsertQueryBuilder setField(String fieldName)
      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

      public String 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.