httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torge Riedel <torgerie...@gmx.de>
Subject [users@httpd] mod_authn_dbd: Stored procedures not supported ... "Commands out of sync; you can't run this command now"
Date Sun, 29 Jun 2014 12:25:44 GMT
Hi,

I'm having a server installed with Apache 2.2 (Ubuntu LTS 12.04) and I used mod_authn_dbd
as documented here

http://httpd.apache.org/docs/2.2/mod/mod_authn_dbd.html

to check the permissions.

Since I use a MySQL database

DBDriver mysql

is set.
Since there is already an existing user management on a different server with access restrictions,
the only way to use it is via a stored procedure, thus

AuthDBUserPWQuery "CALL queryUser(%s)"

is defined like this.
But this is a problem, since MySQL is - let's say - a little bit special when performing a
query which is a call to a stored procedure. If
you just perform the query and fetch the result, the next query within the same connection
will fail with "Commands out of sync; you can't run this command now" error.

The reason is that when performing a query with a call to a stored procedure you must take
result sets into account like you do when doing a multi-query.

Multi-Query:

"SELECT * FROM tUsers1; SELECT * FROM tUsers2;"

returns in MySQL two result sets and you have to use

mysql_use_result()
mysql_store_result()
mysql_free_result()

to properly handle the returned data. And in ANY case where stored procedures are involved,
you have to use the methods above otherwise to you get error.
I think the reason is, that in stored procedures you can execute two or more SELECTs.

I already tried to find the location in the httpd sources where a fix is needed, but it seems
to me that httpd is using the apr db driver interface.
Maybe the fix has to be done there and not in httpd source, but I'm not sure.

Regards
Torge

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message