比较审计跟踪的值
我正在尝试为用 PLSQL/PHP 编写的现有数据库开发审计跟踪/跟踪解决方案 - 但是我仍然不确定是否有一个简单(易于实现和维护)的解决方案来跟踪字段/值的更改。例如,DB APP 的项目跟踪部分跟踪超过 200 个字段,理想情况下,我想要一种很好的方式来显示更改历史记录,例如:
5/10/2010 - Project 435232 updated by John Doe
Changed Project Name (Old: Test Project; New: Super Test Project)
Changed Submission Date (Old: 5/10/2010; New: 5/11/2010)
Changed Description (Old: This is an example!; New: This is a test example)
本质上,对于每个字段(数据库列),它将输出一个新行来显示旧/新值。到目前为止,我当前的想法是将数据的当前版本保存到临时表中,用新数据更新主表,然后将每一行加载到数组中并进行数组比较以确定差异。这看起来有点复杂,如果有更简单的方法我很想知道。
非常感谢任何想法或建议!
I'm attempting to develop an audit trail/tracking solution for an existing database written in PLSQL/PHP - however I'm still unsure as of yet on an easy (to implement and maintain) solution for tracking changes to fields/values. For instance, the project tracking portion of the DB APP tracks over 200 fields and ideally I'd like a nice way to show a history of changes, such as:
5/10/2010 - Project 435232 updated by John Doe
Changed Project Name (Old: Test Project; New: Super Test Project)
Changed Submission Date (Old: 5/10/2010; New: 5/11/2010)
Changed Description (Old: This is an example!; New: This is a test example)
Essentially for each field (db column) it would output a new line to show the old/new values. So far my current idea is saving the current version of the data to a temporary table, updating the primary table with the new data then loading each row into an array and doing an array compare to determine the differences. This seems a bit convoluted, and if there is an easier method I'd love to know it.
Any ideas or suggestions are much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您提出的是一个非常糟糕的 - 但非常普遍提出的 - 实现,原因我在 这个最近的 SO 线程。
What you propose is a very bad - yet very commonly proposed - implementation, for the reasons I list in this other recent SO thread.