How to execute Stored Procedures with Doctrine2 and MySQL(如何使用 Doctrine2 和 MySQL 执行存储过程)
问题描述
我在 Symfony2 应用程序中工作,我需要使用存储过程来执行一些高性能进程.
I am working in a Symfony2 application and I need to use Stored Procedures to do some high performance processes.
有什么方法可以使用 Doctrine2 执行(和管理参数)MySQL 存储过程?
There are any way to execute (and manage parameters) a MySQL Stored Procedure using Doctrine2?
解决方案:
$em = $this->getDoctrine()->getEntityManager();
$qb = $em->createNativeQuery(
'CALL USR_P_UserRegistration (' .
':iduser, :name, :surname, :birthday, :idlang, :idregistry' .
')',
new ResultSetMapping()
);
$qb->setParameters(
array(
'iduser' => $c->getIduser(),
'name' => $c->getName(),
'surname' => $c->getSurname(),
'birthday' => $c->getBirthday(),
'idlang' => $c->getIdlang(),
'idregistry' => $c->getIdregistry()
));
$qb->execute();
$em->flush();
推荐答案
您可以使用 Native SQL,甚至可以使用存储过程进行数据检索.
you can use Native SQL and you could even use stored procedures for data retrieval.
doc Native sql 一个>
或者您可以查看此链接
如何在 Symfony 和 Doctrine 中使用存储过程一个>
这篇关于如何使用 Doctrine2 和 MySQL 执行存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 Doctrine2 和 MySQL 执行存储过程


基础教程推荐
- 带更新的 sqlite CTE 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01