使用jOOQ和PostgreSQL,有没有办法知道对合并、插入或更新执行了什么操作?
例如,使用jOOQ文档中的示例:
create.mergeInto(AUTHOR)
.using(create.selectOne())
// Suppose the last name is unique (natural key) in my case
.on(AUTHOR.LAST_NAME.eq("Hitchcock"))
.whenMatchedThenUpdate()
.set(AUTHOR.FIRST_NAME, "John")
.whenNotMatchedThenInsert(AUTHOR.LAST_NAME)
.values("Hitchcock")
.execute();
理想情况下,如果可能的话,我将同时获得结果行和执行的操作.
Note:不是this question的复制品.这是SQL Server特有的.我的是PostgreSQL和jOOQ特定的.