qb
qb copied to clipboard
`update` with `returning` does not create an output clause in sql server grammer
getInstance("QueryBuilder@qb")
.from("foo")
.returning(["bar","baz"])
.where("key", "=", "someValue")
.update(values={freshValue: 42}, toSql=true);
produces
UPDATE [foo] SET [FRESHVALUE] = ? WHERE [key] = ?
but should be something like
UPDATE [foo] SET [FRESHVALUE] = ? OUTPUT INSERTED.[bar], INSERTED.[baz] WHERE [key] = ?
probably returning
in an update context would need to accept something like
returning({inserted: ["bar","baz"], deleted: ["bar","baz"]})
since an UPDATE can output both the old and new values.