<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7036.0">
<TITLE>Using STORED PROCEDURE with Freeradius </TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P ALIGN=LEFT><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">Hi,<BR>
<BR>
</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">For some reasons</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">I</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">'ve</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> to use Stored proc</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">edure</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> With Freeradius but</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">I</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> am getting following error from mysql:<BR>
<BR>
</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">Error: 1312 SQLSTATE: 0A000 (ER_SP_BADSELECT) </FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">Message: PROCEDURE %s can't return a result set in the given context</FONT></I></SPAN><SPAN LANG="en-us"><I></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">You can consider the following example:<BR>
</FONT></SPAN><SPAN LANG="en-us"><BR>
<FONT SIZE=2 FACE="Courier New">Instead of following authorize_check_query</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New"> authorize_check_query = "SELECT id, UserName, Attribute, Value, op, uid \</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New"> FROM ${authcheck_table} \</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New"> WHERE Username = '%{SQL-User-Name}' \</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New"> ORDER BY id"</FONT></I></SPAN><SPAN LANG="en-us"><I></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">I want to use this:</FONT></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">authorize_check_query = "CALL molo('%{SQL-User-Name}')"</FONT></I></SPAN><SPAN LANG="en-us"><I></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">A</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">nd</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> this is my stored proc in mysql:<BR>
<BR>
</FONT></SPAN><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">DELIMITER $$;</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">DROP PROCEDURE IF EXISTS `radius`.`molo`$$</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">CREATE PROCEDURE `molo`(did VARCHAR(10))</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">BEGIN</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">DECLARE rid INT;</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">DECLARE ruid VARCHAR(15);</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">DECLARE rattr VARCHAR(15);</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">DECLARE rop CHAR(2);</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">DECLARE rval VARCHAR(10);</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">SELECT id, UserName, Attribute, Value, op INTO rid,ruid,rattr,rop,rval from radcheck WHERE UserName=did;</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">SELECT rid,ruid,rattr,rop,rval;</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">END$$</FONT></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><I><FONT COLOR="#993300" SIZE=2 FACE="Courier New">DELIMITER;$$</FONT></I></SPAN><SPAN LANG="en-us"><I></I></SPAN></P>
<P ALIGN=LEFT><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">I can call this stored proc From any</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">my</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">sql client</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">successfully</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">,</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> but if</FONT></SPAN><SPAN LANG="en-us"> <FONT SIZE=2 FACE="Courier New">I</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> call it from sql.conf it give</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">s</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New"> error</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">: 1312</FONT></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Courier New">.</FONT></SPAN><SPAN LANG="en-us"><BR>
<BR>
<FONT SIZE=2 FACE="Courier New">Any solution please?<BR>
<BR>
Thanks in advance<BR>
Saeed Ahmed.</FONT></SPAN><SPAN LANG="en-us"><I></I></SPAN></P>
</BODY>
</HTML>