【发布时间】:2012-06-02 14:34:32
【问题描述】:
我正在使用 Coldfusion8 并试图获得一个简单的存储过程来运行 MySQL id-lookup。
当我从 MySQL 内部启动该过程时,它正在工作。但是在我的 Coldfusion 页面上,什么也没有发生。
这是我的程序:
CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_select_extern`(IN `iln_to_match` VARCHAR(13))
LANGUAGE SQL
NOT DETERMINISTIC
READS SQL DATA
SQL SECURITY DEFINER
COMMENT ''
BEGIN
SELECT tn.iln
FROM teilnehmer AS tn
WHERE tn.iln = iln_to_match
LIMIT 1;
END
我在 Coldfusion 中的程序调用:
<cfstoredproc procedure="proc_select_extern" datasource="dns">
<cfprocparam type="in" value="#Session.Extern#" cfsqltype="cf_sql_varchar" maxlength="13">
<cfprocresult name="extern">
</cfstoredproc>
<cfoutput query="extern">
<p>Hello #extern.username#</p>
</cfoutput>
我想我至少会在 MySQL 中得到一个CALL proc_select_extern('value'); 报告,但我什至没有得到这个。
编辑:
所以我让它像这样在一个空页面上作为 CFQUERY 工作:
<cfquery datasource="db" NAME="extern">
SELECT tn.iln
FROM teilnehmer AS tn
WHERE tn.iln = #Session.Extern#
LIMIT 1
</cfquery>
<cfdump var="#extern#">
<cfoutput>#IsDebugMode()#</cfoutput>
现在尝试使用 storedProc。
【问题讨论】:
-
cfoutput 循环不是一个好的试金石。正如 Dave 建议的那样,启用调试,这样您就可以看到对数据库进行的任何调用。另外,尝试 cfdumping 整个查询,即 `cfdump var="#extern#"
-
@Leigh 通过在 URL 中添加 mode=debug 来启用调试?我也在尝试cfump。谢谢!
-
必须在 CF 管理员中启用调试(并且允许您的 IP)。确定是否启用:
<cfoutput>#IsDebugMode()#</cfoutput>
标签: mysql stored-procedures coldfusion