【发布时间】:2011-10-22 10:39:48
【问题描述】:
我一直在尝试将存储过程创建步骤放入我在 Magento 中的 SQL 升级脚本中。 喜欢
$this->startSetup();
$sql = <<< __SQLPRC
CREATE PROCEDURE my_proc(
IN length int
,IN column_used_for varchar(50)
,OUT return_id bigint
)
BEGIN
DECLARE count_unused INT;
SET count_unused = 0;
select
id into return_id
from
my_table
where
used_status=0
limit 1;
if length(return_id) = length
then
update my_table
set
used_status=1
where
id = return_id;
else
set return_id = 0;
end if;
END;
__SQLPRC;
try {
$this->run($sql);
}
catch(Exception $e)
{ echo "<pre>" . $e->getTraceAsString(); }
$this->endSetup();
我从调试中得出的结论是,Magento 只抓取 SQL 直到第一个分号“;”
有人可以帮我解决这个问题吗?
【问题讨论】:
标签: php stored-procedures magento