简体   繁体   English

连接提交后的学说和存储过程

[英]Doctrine and stored procedure after connection commit

I'm trying to call a stored procedure in my project, AFTER an object is saved (like a trigger would do, but MySQL doesn't allow calling stored procedure within a trigger). 我试图在我的项目中调用存储过程,然后保存对象(就像触发器一样,但是MySQL不允许在触发器内调用存储过程)。

First try : I wrote the call in the postInsert() hook, in Doctrine_Record. 首先尝试:我在Doctrine_Record的postInsert()挂钩中编写了该调用。 At this moment, the transaction is not committed to the database, so wrong way. 此时,事务没有提交给数据库,所以方式错误。

Second try : I wrote an EventListener and call the postTransactionCommit() event. 第二次尝试:我编写了一个EventListener并调用postTransactionCommit()事件。 It works fine, except that I'm not able at this level to know what table was modified. 它工作正常,除了我无法在此级别知道修改了哪个表。 I can know what tables are 'initialized' in this connection, but that's all. 我知道在此连接中哪些表已“初始化”,仅此而已。 And I don't want to call my stored procedure if I'm doing only a SELECT in the transaction. 而且,如果我在事务中仅执行SELECT,则不想调用存储过程。

So now I'm stucked... Do you see a lead I did not follow? 所以现在我被困住了...您看到我没有遵循的线索了吗?

Thanks 谢谢

我通过重写Doctrine_Record中的save()方法解决了该问题,因此在save()之后才建立连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有条件地在没有存储过程的情况下在MySQL上提交事务 - Conditionally commit transactions on MySQL without stored procedure 来自 sqlalchemy 的存储过程调用未提交 - stored procedure call from sqlalchemy not commit 如何使用doctrine 2在symfony 2中使用输出参数调用mysql存储过程? - How to call mysql stored procedure with output parameter in symfony 2 using doctrine 2? 我如何才能调用存储过程(使用zf2,原则2)? - How i can call stored procedure (uses zf2, doctrine 2)? 使用存储过程建立MySQL数据库连接 - Making a MySQL database connection with a stored procedure 调用存储过程后,MySQL存储过程的OUT参数为null - OUT parameter of MySQL stored procedure is null after calling stored procedure Lumen / Laravel 5.1-调用存储过程似乎提交事务 - Lumen/Laravel 5.1 - calling stored procedure appears to commit transaction 使用MySQLWorkbench内部的Transaction执行存储过程是否总是自动提交? - Execute Stored Procedure with Transaction inside MySQLWorkbench alway commit automatically? 连接尝试失败,因为连接方在一段时间后没有正确响应。 从 C# 调用存储过程时 - A connection attempt failed because the connected party did not properly respond after a period of time. when calling Stored Procedure from C# 调用存储过程后超时 - Timeout expired after calling stored procedure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM