A little problem - FR with Mysql Stored Procedure
Dear Sir, I was wondering on mailing list for last 3 days and I didn't get proper response, I am really in problem. I am getting problem to use Mysql Stored procedures with Freeradius. After exploring web It came to know that, (this text I got from mysql.com forum:) the result's of SP execution are sent as result sets over the protocol. Once you call a SP you get at least 1 return code and could get many result sets. The execution of a stored procedure is very similar to execution of a multi-query. MySQL 5.0 supports the execution of multiple statements specified in a single query string. To use this capability with a given connection, you must specify the CLIENT_MULTI_STATEMENTS option in the flags parameter to mysql_real_connect() when opening the connection. You can also set this for an existing connection by calling mysql_set_server_option(MYSQL_OPTION_MULTI_STATEMENTS_ON). By default, mysql_query() and mysql_real_query() return only the first query status and the subsequent queries status can be processed using mysql_more_results() and mysql_next_result(). /* Connect to server with option CLIENT_MULTI_STATEMENTS */ mysql_real_connect(..., CLIENT_MULTI_STATEMENTS); /* Now execute multiple queries */ mysql_query(mysql,"DROP TABLE IF EXISTS test_table;\ CREATE TABLE test_table(id INT);\ INSERT INTO test_table VALUES(10);\ UPDATE test_table SET id=20 WHERE id=10;\ SELECT * FROM test_table;\ DROP TABLE test_table"); Means I need to use CLIENT_MULTI_STATEMENTS in mysql_real_connect(), so, for now, I just need this little guidance that which file should I edit to get SP working with Freeradius. I hope I'll get response this time thanking you in advance Best Regards
Saeed Ahmed wrote:
Means I need to use CLIENT_MULTI_STATEMENTS in mysql_real_connect(), so, for now, I just need this little guidance that which file should I edit to get SP working with Freeradius.
I would think that sql.conf would be the place to start. After that I would guess you would have to prod around rlm_sql if you are returning an array or result set if rlm is expecting someting else. -- Lewis Bergman Texas Communications 4309 Maple St. Abilene, TX 79602-8044 Off. 325-691-1301 Cell 325-439-0533 fax 325-695-6841
Thanks for reply, ##sql.conf## I wrote authorize_check_query= "call proc_name...."; This is ok, but to get it in action, I mean without errors, I need to edit mysql_real_connect() I thought I could change it in freeradius-1.0.5/src/modules/rlm_sql/drivers/rlm_sql_mysql/sql_mysql.c There I found mysql_real_connect() in static int sql_init_socket() function I edited mysql_real_connect(), by putting CLIENT_MULTI_STATEMENTS in it. then Cd freeradius-1.0.5 ./configure Make Make install But there was no effect. Even I made some syntax errors in sql_mysql.c but stil there was no effect, It seems that I didn't compiled well or freeradius don't use sql_mysql.c file. need more help plzz Thanks -----Original Message----- From: freeradius-users-bounces+saeed=n-g-c.com@lists.freeradius.org [mailto:freeradius-users-bounces+saeed=n-g-c.com@lists.freeradius.org] On Behalf Of Lewis Bergman Sent: Thursday, February 09, 2006 2:10 PM To: FreeRadius users mailing list Subject: Re: A little problem - FR with Mysql Stored Procedure Saeed Ahmed wrote:
Means I need to use CLIENT_MULTI_STATEMENTS in mysql_real_connect(), so, for now, I just need this little guidance that which file should I edit to get SP working with Freeradius. I would think that sql.conf would be the place to start. After that I would guess you would have to prod around rlm_sql if you are returning an array or result set if rlm is expecting someting else.
-- Lewis Bergman Texas Communications 4309 Maple St. Abilene, TX 79602-8044 Off. 325-691-1301 Cell 325-439-0533 fax 325-695-6841 - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
"Saeed Ahmed" <saeed@n-g-c.com> wrote:
But there was no effect. Even I made some syntax errors in sql_mysql.c but stil there was no effect, It seems that I didn't compiled well or freeradius don't use sql_mysql.c file.
Read the output of "configure" and "make". Odds are that the rlm_sql_mysql module isn't being built because you haven't installed the libraries it needs. As always, *read* the messages produced by your machine. If you're not going to read them, then you're not going to know what it's doing, and you're not going to solve your problem. Reading the messages is often faster than asking questions on a mailing list, and (mayybe)getting a reply many hours later. Alan DeKok.
participants (3)
-
Alan DeKok -
Lewis Bergman -
Saeed Ahmed