【问题标题】:How to return OUT parameters from stored procedure in Symfony 1.4 using Doctrine如何使用 Doctrine 从 Symfony 1.4 中的存储过程返回 OUT 参数
【发布时间】:2015-04-08 23:50:24
【问题描述】:

我不确定如何使用教义从 symfony 中的存储过程中正确检索 OUT 参数。

我的存储过程如下:

PROCEDURE procedure_name (IN val1 NUMERIC(10), ... , OUT out1 NUMERIC(10), OUT out2 NUMERIC(10), OUT out3 NUMERIC(10))

我试过了:

$sql = "CALL procedure_name('$val1', ... , @out1, @out2, @out3)";
$con = Doctrine_Manager::connection();
$statement = $con->prepare($sql);
$statement->execute();
$result = $con->query("SELECT @out1, @out2, @out3")->fetch_object();

但是失败并显示错误“您必须在您的 from 中指定至少一个组件。”

有什么想法吗?

【问题讨论】:

    标签: php mysql doctrine symfony-1.4


    【解决方案1】:

    解决方案:

    $sql = "CALL procedure_name('$val1', ... , @out1, @out2, @out3)";
    $con = Doctrine_Manager::getInstance()->getCurrentConnection();
    $statement = $con->prepare($sql);
    $statement->execute();
    $statement->closeCursor();
    $result = $con->fetchAssoc("SELECT @out1, @out2, @out3");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-22
      • 2023-03-31
      相关资源
      最近更新 更多