如何查看 .w 触发器是否适用于我的查询?

How to see .w trigger is working for my query?

仅供参考,我只想了解 WRITE 触发器如何针对下面的查询执行。可以看到吗?

    FOR EACH Customer EXCLUSIVE-LOCK WHERE NAME = "Go Fishing Ltd":
      ASSIGN  Customer.Balance = 600.
    END.

添加:

-clientlog path/to/log.log -logginglevel 4 -logentrytypes 4GLTrace

到您的启动命令。

这将为您的代码进行的所有调用创建一个日志。

更多信息:https://knowledgebase.progress.com/articles/Knowledge/P9893

您还可以在代码中使用 LOG-MANAGER 系统句柄在运行时动态控制日志记录:

https://docs.progress.com/bundle/openedge-abl-troubleshoot-applications/page/LOG-MANAGER-system-handle-attributes-and-methods.html

但是为了像这样的简单目的,只添加启动参数会更容易。

观看 log-manager 显示正在 sports2020 数据库上执行的写入触发器:

def var clog as char no-undo.
def var lclog as longchar no-undo.

assign
    clog = guid + '.log'.
    log-manager:logfile-name = clog
    log-manager:log-entry-types = '4gltrace:5,4glmessages'
    .

for each Customer exclusive-lock where name = 'Go Fishing Ltd':
    Customer.Balance = Customer.Balance + 1. // write trigger only fires when record changes
end.

log-manager:close-log().
copy-lob from file clog to lclog.
message string( lclog ).

https://abldojo.services.progress.com/?shareId=62978a833fb02369b25479f0

输出中的相关片段:

4GLTRACE       Return from Main Block "Customer Customer" [sports2020trgs/wrcust.p]