Created attachment 24334 [details] allow few additional flags to be passed to mysql_real_connect It is not possible to use CALL MySQL method with apr_dbd_mysql, because libmysqlclient requires CLIENT_MULTI_STATEMENTS and CLIENT_MULTI_RESULTS to be passed, but apr_dbd_mysql accepts only CLIENT_FOUND_ROWS flag. This patch slightly changes apr_dbd_mysql in order to accept these two additional flags.
Created attachment 24372 [details] allow few additional flags to be passed to mysql_real_connect Flags are not exclusive, so we must use if's, not else if's
(In reply to comment #0) > Created attachment 24334 [details] > allow few additional flags to be passed to mysql_real_connect > > It is not possible to use CALL MySQL method with apr_dbd_mysql, because > libmysqlclient requires CLIENT_MULTI_STATEMENTS and > CLIENT_MULTI_RESULTS to be passed, but apr_dbd_mysql accepts only > CLIENT_FOUND_ROWS flag. > > This patch slightly changes apr_dbd_mysql in order to accept these two > additional flags. This patch may solve use problem, but then another problem appearing, "Commands out of synch" as declared in mysql ref. as common error http://dev.mysql.com/doc/refman/5.1/en/commands-out-of-sync.html There is a solution. http://dev.mysql.com/doc/refman/5.1/en/c-api-multiple-queries.html But applying the solution described above to current design of apr_mysql_dbd_driver does not seem easy to me. Also I've tested and succeed to use underlaying MYSQL connection like MYSQL *mysql = ((apr_dbd_t*)db->handle)->conn; status = mysql_query(mysql,"CALL xgetposts;"); do { /* did current statement return data? */ //MYSQL_RES *result = mysql_store_result(mysql); MYSQL_RES *result = mysql_use_result(mysql); if (result) { MYSQL_ROW row; while ((row = mysql_fetch_row(result))) { ap_rprintf(r, "<h2> %s</h2>%s\n%s</br><hr>\n", row[2], row[1], ap_escape_html(r->pool, row[3])); // ap_rprintf(r, "<h2>%s</h2>%s\n%s</br><hr>\n", row[2], row[1], (r->pool, row[3])); } mysql_free_result(result); } /* more results? -1 = no, >0 = error, 0 = yes (keep looping) */ if ((status = mysql_next_result(mysql)) > 0) printf("Could not execute statement\n"); } while (status == 0);