java.lang.Object
io.github.projectunified.craftdatabase.client.sql.helper.UpdateBuilder

public final class UpdateBuilder extends Object
A builder for UPDATE queries
  • Method Details

    • create

      public static UpdateBuilder create(String table)
      Create a new builder
      Parameters:
      table - the table
      Returns:
      the builder
    • set

      public UpdateBuilder set(String assignment, Object... values)
      Add an assignment, e.g. set("name = ?", "new name") or set("count = count + 1")
      Parameters:
      assignment - the assignment, the ? placeholders must match the values
      values - the values for the placeholders, omitted to provide them later in a batch
      Returns:
      this builder for chaining
    • where

      public UpdateBuilder where(String condition, Object... values)
      Add a condition, joined to the previous ones with AND
      Parameters:
      condition - the condition, the ? placeholders must match the values
      values - the values for the placeholders, omitted to provide them later in a batch
      Returns:
      this builder for chaining
    • build

      public Query build()
      Build the query
      Returns:
      the query