Class DeleteQueryBuilder

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

public class DeleteQueryBuilder extends QueryBuilder
Represents a SQL DELETE query builder for constructing DELETE statements with optional WHERE conditions. Extends the base class QueryBuilder.
Since:
1.0
Author:
Blyzhnytsia Team
  • Constructor Details

    • DeleteQueryBuilder

      public DeleteQueryBuilder(String tableName)
      Constructs a new DeleteQueryBuilder with the specified table name.
      Parameters:
      tableName - The name of the table from which to delete records.
  • Method Details

    • from

      public static DeleteQueryBuilder from(String tableName)
      Creates a new DeleteQueryBuilder with the specified table name.
      Parameters:
      tableName - The name of the table from which to delete records.
      Returns:
      A new instance of DeleteQueryBuilder.
    • whereCondition

      public DeleteQueryBuilder whereCondition(String condition)
      Adds a WHERE condition to the DELETE query.
      Parameters:
      condition - The WHERE condition to be added.
      Returns:
      The current DeleteQueryBuilder instance for method chaining.
    • andCondition

      public DeleteQueryBuilder andCondition(String condition)
      Adds an AND condition to the existing WHERE conditions.
      Parameters:
      condition - The AND condition to be added.
      Returns:
      The current DeleteQueryBuilder instance for method chaining.
    • orCondition

      public DeleteQueryBuilder orCondition(String condition)
      Adds an OR condition to the existing WHERE conditions.
      Parameters:
      condition - The OR condition to be added.
      Returns:
      The current DeleteQueryBuilder instance for method chaining.
    • betweenCondition

      public DeleteQueryBuilder betweenCondition(String field, Object lowerBound, Object upperBound)
      Adds a BETWEEN condition to the existing WHERE conditions.
      Parameters:
      field - The field to which the BETWEEN condition applies.
      lowerBound - The lower bound of the range.
      upperBound - The upper bound of the range.
      Returns:
      The current DeleteQueryBuilder instance for method chaining.
    • buildDeleteStatement

      public String buildDeleteStatement()
      Builds the DELETE SQL statement based on the configured conditions.
      Returns:
      The generated DELETE SQL statement as a string.