UpdateQuery
An UPDATE under construction. setValue and setValues assign from @name parameters supplied at the terminal; setExpression assigns SQL, which may read the column: setExpression("quantity", "quantity - 1").
A WHERE is required. An UPDATE of every row is written with rawQuery.
db.update("legion_supplies")
.setExpression("quantity", "quantity - @taken")
.setValue("last_drawn_at")
.where("id = @id")
.executeUpdate("taken" to 1, "last_drawn_at" to now, "id" to supplyId)Properties
Functions
This query with terminals that return a DataResult instead of throwing, on the boundary dbResult applies - a fetch*Strict that found no row still throws.
Turns this query into a step of a TransactionPlan instead of running it. The parameters given at the step's terminal may hold TransactionValues pointing at earlier steps.
Returns an independent copy, so that variants can be built from a shared base.
Carries registered converters into a builder's copy(), alongside whatever clauses it copies.
Runs the statement and returns how many rows it affected.
As fetchField, but the query must return exactly one row rather than at most one.
Runs the query and returns its single row, throwing where the count was anything but one.
Runs the query and hands the first column of each row, as T, to block as forEachRow does.
Runs the query and hands each row, mapped onto T, to block as it arrives, as forEachRow does.
Sets the FROM clause, for an update that reads from other tables.
The driver query every terminal runs, carrying this query's own converters.
Marks the WITH clause RECURSIVE.
Registers a ParameterConverter for this query alone, on the terms of registerResultConverter.
Registers a ResultConverter for this query alone, consulted ahead of the session's. A later registration here wins over an earlier one.
Adds a RETURNING clause, which turns this into a query the fetch* family can read.
Assigns one column from a SQL expression, which may read the column it is assigning.
As setExpression, for several columns at once.
Assigns one column from the @column parameter.
Assigns each column from the parameter of the same name.
Assigns the columns named by data's keys, each from the parameter of the same name. The map's values are not read, so pass it to the terminal too.
Sets the WHERE condition. Required.
Adds a common table expression. Call it more than once for more than one.