multiple fields from rlm_mysql?
Hi, I would like to know if have some way to do the below example in a single query. something like a tuple/foreach or otherwise way. my current solution is: My-AVP-A = "%{sql: SELECT field_a FROM tb_my WHERE field_a = '%{Value_A}'}" My-AVP-B = "%{sql: SELECT field_b FROM tb_my WHERE field_b = '%{Value_B}'}" My-AVP-C = "%{sql: SELECT field_c FROM tb_my WHERE field_c = '%{Value_C}'}" My-AVP-D = "%{sql: SELECT field_d FROM tb_my WHERE field_d = '%{Value_D}'}" the problem it's because i would like to avoid multiple queries. -- Jorge Pereira
On Apr 29, 2015, at 1:57 PM, Jorge Pereira <jpereiran@gmail.com> wrote:
I would like to know if have some way to do the below example in a single query. something like a tuple/foreach or otherwise way.
Sadly, no. We've discussed ways to fix that, but it's not simple.
the problem it's because i would like to avoid multiple queries.
Yes. Many people would like that. Alan DeKok.
do you know where i can found the discusse about that? i didn't find. I really would like to focus about it... intend to work in an solution. -- Jorge Pereira On Wed, Apr 29, 2015 at 3:04 PM, Alan DeKok <aland@deployingradius.com> wrote:
On Apr 29, 2015, at 1:57 PM, Jorge Pereira <jpereiran@gmail.com> wrote:
I would like to know if have some way to do the below example in a single query. something like a tuple/foreach or otherwise way.
Sadly, no. We've discussed ways to fix that, but it's not simple.
the problem it's because i would like to avoid multiple queries.
Yes. Many people would like that.
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Apr 29, 2015, at 3:11 PM, Jorge Pereira <jpereiran@gmail.com> wrote:
do you know where i can found the discusse about that? i didn't find. I really would like to focus about it... intend to work in an solution.
Mostly it was off-list between Arran and myself. Please open an issue on github with your ideas, and we can discuss it from there. Alan DeKok.
done https://github.com/FreeRADIUS/freeradius-server/issues/984 -- Jorge Pereira On Wed, Apr 29, 2015 at 4:22 PM, Alan DeKok <aland@deployingradius.com> wrote:
On Apr 29, 2015, at 3:11 PM, Jorge Pereira <jpereiran@gmail.com> wrote:
do you know where i can found the discusse about that? i didn't find. I really would like to focus about it... intend to work in an solution.
Mostly it was off-list between Arran and myself.
Please open an issue on github with your ideas, and we can discuss it from there.
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Apr 29, 2015, at 3:51 PM, Jorge Pereira <jpereiran@gmail.com> wrote:
done
Just an update for this. We've decided to create a new 'map proc' API (instead of hacking xlats to do more). This allows multi attribute, multi value, results to be mapped to server attributes. The tentative syntax looks something like: map <map proc isnt> <source> { <server attr0> <op> <result attr0> <server attr1> <op> <result attr1> <server attrN> <op> <result attrN> } update request { Tmp-String-0 := 'replyMessage' } map sql "SELECT * FROM foo WHERE 1;" { User-Name = 'username' User-Password = 'cleartextpassword' Reply-Message += &Tmp-String-0 } Behind the scenes, processing of the LHS is identical to an update section. Like xlat, the map proc API allows registrations of map proc callbacks. So each module can register multiple callbacks. The map section will return an rcode indicating success or failure. This simple syntax provides a nice way of processing complex JSON, YAML, XML documents. Although it doesn't exist yet, something like: map json "%{rest:http://example.org/foo <http://example.org/foo> GET}" { User-Name = '.user.name' } User-Password = '.user.password' should be possible. I've pushed a simple map proc API to the v3.1.x branch, along with map proc callbacks for SQL, and LDAP. Currently mysql, postgresql and sqlite drivers are supported. To be supported the drive must implement the sql_fields method, which returns an array of field/column names for the result. https://github.com/FreeRADIUS/freeradius-server/commit/dead5fe0636af3b8745b4... Pull requests for the other drivers would be appreciated. -Arran
participants (3)
-
Alan DeKok -
Arran Cudbard-Bell -
Jorge Pereira