<br><br><div><span class="gmail_quote">2006/2/7, Saeed Ahmed <<a href="mailto:saeed@n-g-c.com">saeed@n-g-c.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<p align="left"><span lang="en-us"><font face="Courier New" size="2">Hi,<br>
<br>
</font></span><span lang="en-us"><font face="Courier New" size="2">For some reasons</font></span><span lang="en-us"> <font face="Courier New" size="2">I</font></span><span lang="en-us"><font face="Courier New" size="2">'ve
</font></span><span lang="en-us"><font face="Courier New" size="2"> to use Stored proc</font></span><span lang="en-us"><font face="Courier New" size="2">edure</font></span><span lang="en-us"><font face="Courier New" size="2">
With Freeradius but</font></span><span lang="en-us"> <font face="Courier New" size="2">I</font></span><span lang="en-us"><font face="Courier New" size="2"> 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" face="Courier New" size="2">Error: 1312 SQLSTATE: 0A000 (ER_SP_BADSELECT) </font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">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 face="Courier New" size="2">You can consider the following example:<br>
</font></span><span lang="en-us"><br>
<font face="Courier New" size="2">Instead of following authorize_check_query</font></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2"> 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" face="Courier New" size="2"> FROM ${authcheck_table} \</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2"> WHERE Username = '%{SQL-User-Name}' \</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2"> ORDER BY id"</font></i></span><span lang="en-us"><i></i></span></p>
<p align="left"><span lang="en-us"><font face="Courier New" size="2">I want to use this:</font></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">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 face="Courier New" size="2">A</font></span><span lang="en-us"><font face="Courier New" size="2">nd</font></span><span lang="en-us"><font face="Courier New" size="2"> this is my stored proc in mysql:
<br>
<br>
</font></span><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">DELIMITER $$;</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">DROP PROCEDURE IF EXISTS `radius`.`molo`$$</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">CREATE PROCEDURE `molo`(did VARCHAR(10))</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">BEGIN</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">DECLARE rid INT;</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">DECLARE ruid VARCHAR(15);</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">DECLARE rattr VARCHAR(15);</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">DECLARE rop CHAR(2);</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">DECLARE rval VARCHAR(10);</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">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" face="Courier New" size="2">SELECT rid,ruid,rattr,rop,rval;</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">END$$</font></i></span></p>
<p align="left"><span lang="en-us"><i><font color="#993300" face="Courier New" size="2">DELIMITER;$$</font></i></span><span lang="en-us"><i></i></span></p>
<p align="left"><span lang="en-us"><font face="Courier New" size="2">I can call this stored proc From any</font></span><span lang="en-us"> <font face="Courier New" size="2">my</font></span><span lang="en-us"><font face="Courier New" size="2">
sql client</font></span><span lang="en-us"> <font face="Courier New" size="2">successfully</font></span><span lang="en-us"><font face="Courier New" size="2">,</font></span><span lang="en-us"><font face="Courier New" size="2">
but if</font></span><span lang="en-us"> <font face="Courier New" size="2">I</font></span><span lang="en-us"><font face="Courier New" size="2"> call it from sql.conf it give</font></span><span lang="en-us"><font face="Courier New" size="2">
s</font></span><span lang="en-us"><font face="Courier New" size="2"> error</font></span><span lang="en-us"><font face="Courier New" size="2">: 1312</font></span><span lang="en-us"><font face="Courier New" size="2">.</font>
</span><span lang="en-us"><br>
<br>
<font face="Courier New" size="2">Any solution please?<br>
<br>
Thanks in advance<br>
Saeed Ahmed.</font></span><span lang="en-us"><i></i></span></p>
<br>-<br>List info/subscribe/unsubscribe? See <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a><br><br>
</blockquote></div><br><br clear="all">Perhaps it's happen because the field name returned by the molo procedure.<br>I think you have to use UserName insted of ruid because UserName field already mapped to User-Name Attribute. Or you have to change how freeradius map the attributes with field in your database.
<br><br>Regards<br><br>Agus<br>-- <br>-----BEGIN GEEK CODE BLOCK-----<br>Version: 3.1<br>GCS d(-) s:- a--- C++(+++)$>++++$ UL$>++++$ P+? L++$>$ !E--- W++ !N !o !K-- w !O M !V PS PE !Y PGP t 5 X R tv b DI D G e h r y
<br>------END GEEK CODE BLOCK------