Dear list,

scenario:

I am using apache2.4 and mod_dbd + mod_authn_dbd for DB based authentication in 
apache. I started with using the following directive:

AuthDBDUserPWQuery "CALL queryUser(%s)"

but I came into trouble, because calling a stored procedure in MySQL requires 
proper handle of multiple result sets:

https://dev.mysql.com/doc/refman/5.7/en/c-api-multiple-queries.html

In a short summary the current mysql driver of apr-util does not support 
multiple result sets, cause the requirements are:

1.
Support for the flag CLIENT_MULTI_RESULTS must be added to the driver to allow 
specifying it via the DBDParam directive in apache config. Currently only one 
value (CLIENT_FOUND_ROWS) is supported. So IMHO the logic in lines 1167-1170 of 
apr_util/1.6.x/dbd/apr_dbd_mysql.c must be extended in a more generic way to 
support more than one flag. Maybe using the pipe char as a delimiter?

2.
Retrieving the result sets from mysql must be extended to use 
mysql_next_result(), but I do not get the full logic behind dbd_mysql_select in 
lines 231-266 of apr_util/1.6.x/dbd/apr_dbd_mysql.c, the know whether this is 
really possible to implement or if it breaks the logic of the driver api.
In addition, if the caller of the apr-mysql-driver does not step through all 
result sets (I think mod_authn_dbd just looks in the first row) the driver has 
to loop through all remaining result sets using mysql_next_result (this is how 
I understand the doc in the link above).

Thanks in advance and best regards
Torge

Reply via email to