从oracle触发器调用php脚本
问题如下:行插入后我有一个 oracle 触发器。从触发器中,我想调用 php 脚本并将刚刚插入的行字段作为参数传递。
插入来自非常旧的遗留应用程序,几乎没有机会查看源代码。行被频繁插入,可能一次批量插入大约 1000 行,也可能在 30 分钟内插入一行,因此每隔 5 秒检查一次该表是不可行的。
那么,想法是拥有 oracle 触发器,每次插入并调用我的 php 脚本时都会触发它?有什么想法吗?
提前致谢...
Question is following: I have an oracle trigger after row insert. From trigger, I want to call a php script and pass just inserted row fields as parameters.
Insert is coming from very old legacy application with a very little chance of looking at the source code. Rows are inserted frequently, could be batches of ~1000 rows at a time or could be one row in 30minutes, so checking this table every, let's say, 5 seconds is not an option.
So, Idea is to have oracle trigger, which would be triggered every time on insert and call my php script? Any ideas?
Thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当你说“php 脚本”时,你的字面意思是命令行脚本,还是通过 apache/etc 运行的一段 php。
如果是前者,那就选择 OMG Ponies。否则我会使用 UTL_HTTP 来制作调用 Apache/PHP。实际上,我可能会考虑使用这个(如果需要的话更新你的 php/c# )。
但请记住...触发器是事务性的...如果您绝对必须从触发器中调用,请注意您的触发器可能会运行多次(由于 查询重新启动 )并可能完全回滚,导致您的外部(可能是非事务性)php 调用现在无效。如果你的 php 无法处理这个问题,那么也许你的触发器会创建一个作业,甚至一条消息到 AQ 或其他东西中,这也会加快处理速度,你可能并不真正希望你的插入等待外部网络调用。
When you say "php script" do you literally mean a command line script, or a chunk of php being run through apache/etc.
If its the former, then go with OMG Ponies. Otherwise I'd use UTL_HTTP to make the call to Apache/PHP. Actually, I'd probably consider going with this anyway ( updating your php/c# if needed ).
Just remember though.. Triggers are transactional... if you absolutely MUST call out from a trigger be aware that your trigger may run several times ( due to query restart ) and may rollback completely, resulting in your external (presumably non-transactional) php call now being invalid. If your php can't handle this then perhaps have your trigger creating a job or even a message into an AQ or something, this would also speed up handling, you probably don't really want your insert to be waiting on an external web call.