From: Maciek Kolbusz Date: Wed, 13 Nov 2013 16:43:37 +0000 (+0000) Subject: Port number parameter now passed to DBI as integer. X-Git-Tag: v1.5.0-rc1~146^2^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ee72b706233a6caeab438b1ae56afdb2df26b9d;p=thirdparty%2Frrdtool-1.x.git Port number parameter now passed to DBI as integer. --- diff --git a/src/rrd_fetch_libdbi.c b/src/rrd_fetch_libdbi.c index 1d6495de..35261bba 100644 --- a/src/rrd_fetch_libdbi.c +++ b/src/rrd_fetch_libdbi.c @@ -192,11 +192,22 @@ static int _sql_setparam(struct sql_table_helper* th,char* key, char* value) { return -1; } if (getenv("RRDDEBUGSQL")) { fprintf(stderr,"RRDDEBUGSQL: %li: setting option %s to %s\n",time(NULL),key,value ); } - if (dbi_conn_set_option(th->conn,key,value)) { - dbi_conn_error(th->conn,(const char**)&dbi_errstr); - rrd_set_error( "libdbi: problems setting %s to %s - %s",key,value,dbi_errstr); - _sql_close(th); - return -1; + if (strcmp(key, "port") == 0) { + if (dbi_conn_set_option_numeric(th->conn,key,atoi(value))) { + dbi_conn_error(th->conn,(const char**)&dbi_errstr); + rrd_set_error( "libdbi: problems setting %s to %d - +%s",key,value,dbi_errstr); + _sql_close(th); + return -1; + } + } else { + if (dbi_conn_set_option(th->conn,key,value)) { + dbi_conn_error(th->conn,(const char**)&dbi_errstr); + rrd_set_error( "libdbi: problems setting %s to %s - +%s",key,value,dbi_errstr); + _sql_close(th); + return -1; + } } return 0; }