MySQL触发器循环 [英] MySQL trigger loop

查看:88
本文介绍了MySQL触发器循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在经历痛苦的​​过程,以整理出其他人的代码.

I am going through the pain stacking process of sorting out someone else code.

因此,我决定重新创建一个新数据库,使其与旧数据库并排放置,然后使用触发器在两个表之间传输数据.

So I am decided to recreate a new database to sit alongside the old one then to use triggers to transfer data between both tables.

现在我在使用IE循环浏览器时遇到了问题

Now I have an issue with a it looping IE

每个表上的一个触发器,用于更新另一个表.一旦一个更新,它应该更新另一个,但是由于两个表都有触发器,它只会循环,这会引起问题.

A trigger on each table to update the other. Once one updates it should update the other but as both tables have triggers it just will loop which will cause an issue.

他们是否可以阻止这种情况的发生?

Is their a way to stop this from happening ?

希望这是有道理的,希望您能提出建议.

Hope this makes sense and hope you can advise.

推荐答案

您应该在一个数据库中创建条目,并使用触发器将该数据复制到第二个数据库中.话虽如此,您使用检查数据的存在性并退出触发器.基本上,如果记录存在则什么也不做.该站点有一个很好的教程:

You should be making entries in one db and using the trigger to copy that data to the second db. Having said that you use a check for the existence of the data and exit the trigger. Basically an if record exist do nothing. This site has a good tutorial:

http://www.databasedesign-resource.com/mysql-triggers.html

您可能还想了解mySQL手册中的触发器:

You may aloso want to read up on triggers in the mySQL manual:

http://dev.mysql.com/doc/refman/5.0/en/triggers.hthl

这篇关于MySQL触发器循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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