Class UpdateStatement

java.lang.Object
io.github.torand.fastersql.statement.UpdateStatement
All Implemented Interfaces:
Sql, PreparableStatement

public class UpdateStatement extends Object implements PreparableStatement
Implements an UPDATE statement.
  • Method Details

    • set

      public UpdateStatement set(Column column, Expression value)
      Adds an expression value to be updated for a column.
      Parameters:
      column - the column.
      value - the value.
      Returns:
      the modified statement.
    • set

      public UpdateStatement set(Column column, Object value)
      Adds a constant value to be updated for a column.
      Parameters:
      column - the column.
      value - the value.
      Returns:
      the modified statement.
    • set

      public UpdateStatement set(Column column, Optional<?> maybeValue)
      Adds an optional value to be updated for a column. The column is updated only if the optional value is present.
      Parameters:
      column - the column.
      maybeValue - the optional value.
      Returns:
      the modified statement.
    • where

      public UpdateStatement where(Predicate... predicates)
      Adds one or more predicates to the WHERE clause.
      Parameters:
      predicates - the predicates.
      Returns:
      the modified statement.
    • where

      public final UpdateStatement where(OptionalPredicate... maybePredicates)
      Adds optional predicates to the WHERE clause if the wrapped predicates are present.
      Parameters:
      maybePredicates - the optional predicates.
      Returns:
      the modified statement.
    • sql

      public String sql(Context context)
      Description copied from interface: Sql
      Formats object as an SQL fragment.
      Specified by:
      sql in interface Sql
      Parameters:
      context - the context (incl. dialect).
      Returns:
      the formatted SQL fragment.
    • params

      public Stream<Object> params(Context context)
      Description copied from interface: Sql
      Gets the statement parameters introduced by this fragment.
      Specified by:
      params in interface Sql
      Parameters:
      context - the context (incl. dialect).
      Returns:
      the statement parameters.
    • toString

      public String toString()
      Overrides:
      toString in class Object