[Pdns-users] [gmysql] How about add CLIENT_MULTI_RESULTS to smysql.cc ?

Sandro Tosi sandro.tosi at register.it
Mon Mar 21 07:35:15 UTC 2011


Anyone has comment on this patch? Is there a better place I can send it 
for review and (possible) inclusion?

Regards,
Sandro

On 03/08/2011 04:44 PM, Sandro Tosi wrote:
> Hi,
> we're configuring to pdns with a MySQL backend, and using stored
> procedures to query the database.
>
> Sadly, we're facing a problem since mysql_real_connect() in smysql.cc
> does not have the CLIENT_MULTI_RESULTS argument, needed[1][2] to fetch
> multiple rows from a stored proc.
>
> [1] http://dev.mysql.com/doc/refman/5.5/en/c-api-multiple-queries.html
> [2] http://dev.mysql.com/doc/refman/5.5/en/mysql-real-connect.html
>
> We're about to apply the attached patch and recompile pdns, but I'd like
> to hear from you what do you think about it and if you'd like to
> consider it for inclusion in the pdns upstream source code.
>
> Regards,
> Sandro
>
> PS: this is a known problem:
> http://old.nabble.com/gmysql-backend-and-stored-procedures-td19035294.html
>
>
>
> client_multi_results
>
>
> Index: debian-pdns/modules/gmysqlbackend/smysql.cc
> ===================================================================
> --- debian-pdns.orig/modules/gmysqlbackend/smysql.cc	2011-03-08 15:57:20.000000000 +0100
> +++ debian-pdns/modules/gmysqlbackend/smysql.cc	2011-03-08 15:57:45.000000000 +0100
> @@ -20,7 +20,7 @@
>   			  password.empty() ? 0 : password.c_str(),
>   			  database.c_str(), port,
>   			  msocket.empty() ? 0 : msocket.c_str(),
> -			  0)) {
> +			  CLIENT_MULTI_RESULTS)) {
>
>       throw sPerrorException("Unable to connect to database");
>     }
> @@ -91,6 +91,13 @@
>       return true;
>     }
>     mysql_free_result(d_rres);
> +
> +  while (mysql_next_result(&d_db) == 0) {
> +    if (d_rres = mysql_use_result(&d_db)) {
> +      mysql_free_result(d_rres);
> +    }
> +  }
> +
>     d_rres=0;
>     return false;
>   }
>
>
> ATT00001.txt
>
>
> _______________________________________________
> Pdns-users mailing list
> Pdns-users at mailman.powerdns.com
> http://mailman.powerdns.com/mailman/listinfo/pdns-users

-- 
Sandro Tosi
Product Engineer
Shared Hosting Products
R&D | Dada.pro
eml sandro.tosi at register.it



More information about the Pdns-users mailing list