这是创建审计跟踪的最佳方法吗? [英] Is this the best approach to creating an audit trail?

查看:53
本文介绍了这是创建审计跟踪的最佳方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一些功能,以保持对给定用户表单中数据随时间的变化情况进行审核的功能,并在页面底部添加了带日期的审核.例如:

I'm trying to create some functionality that keeps an audit trail of how data in a given user form has been changed over time, with a dated audit at the foot of that page. For example:

09/04/02 21:49名称从汤姆"更改为克里斯".

02/04/09 21:49 Name changed from "Tom" to "Chris".

我这样做是通过将数据以当前格式存储在会话中,然后在保存时检查所存储的数据是否存在任何差异.如果有的话,我会将数据存储在最近的编辑之前的历史记录中,并将新值存储在当前用户表中.

I'm doing this by storing the data in it's present format in the session and then on save checking whether there are any differences in the data being stored. If there are, I'm storing the data how it was before the latest edit in a table called history, and storing the new values in the current user table.

这是最好的方法吗?

推荐答案

一个建议;在数据库触发器中这样做相对容易.在这种情况下,您不必担心运行更新的代码是否记得添加历史记录.

One suggestion; this would be relatively easy to do in a database trigger. In that case, you would never have to worry about whether the code running the update remembers to add a history record.

这篇关于这是创建审计跟踪的最佳方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆