apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47931] It is not possible to use CALL MySQL method with apr_dbd_mysql
Date Wed, 03 Aug 2011 16:47:29 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47931

--- Comment #2 from Firat Sarlar <sfirat@yahoo.com> 2011-08-03 16:47:29 UTC ---
(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);

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message