On Feb 2, 2016, at 10:39 AM, Herwin Weststrate <herwin@quarantainenet.nl> wrote:
On 02-02-16 16:20, Дмитрий wrote:
mysql Stored procedure returns a "Query OK, 0 row affected" radius believes it is not correct so decided.
in freeradius-server-2.2.9 / src / modules / rlm_sql / rlm_sql.c replaced
-if ( numaffected < 1 ) { -ret = RLM_MODULE_NOOP; -}
+if ( (numaffected < 1 && !strstr(querystr,"call")) || (numaffected < 0 && strstr(querystr,"call") ) ) { +ret = RLM_MODULE_NOOP; +}
That looks like a terrible hack. If I had named my table accouting_call this would match too. And I'm not even sure if the return value could possibly be smaller that 0 (it calls a mysql function, which is documented as "Because mysql_affected_rows() returns an unsigned value, you can check for -1 by comparing the return value to (my_ulonglong)-1 (or to (my_ulonglong)~0, which is equivalent).", because that makes everything clearer).
I'm not sure how much alike stored procedures in mysql are compared to postgresql, but wouldn't it be easier to just return a value in that stored procedure?
This is actually fixed in v3.0.x, we distinguish between a constraint violation and no affected rows for MySQL. We're no longer accepting patches of any kind for 2.2.x, it is End of Life. -Arran