Batch Update Rows (LCC.db.edit)
Signature
rows, err = LCC.db.edit(name, rows, timeout?)
Parameters
- name
String. Table name. Must be non-empty and no longer than 256 bytes. - rows
Table. Array of objects containingidplus the fields to update. Every item must include an integer-valuedidgreater than or equal to1. - timeout
Number, optional. Request timeout in seconds, default60.
Returns
- rows
Table. Array of original rows before the update;nilon failure. - err
String ornil. Error message such asunknown tableorunknown column.
Notes
Updates multiple rows by
idand returns the pre-update data.
A missingid, or anidthat is not an integer value greater than or equal to1, triggers a Lua parameter validation error. Theidcolumn itself cannot be updated.
Example
local before, err = LCC.db.edit("tasks", {
{ id = 5, Status = "Done" },
{ id = 6, Status = "Running", Remark = "Manual approval" }
})
if not before then
error(err)
end