]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Port number parameter now passed to DBI as integer. 432/head
authorMaciek Kolbusz <kolbusz@sdf.org>
Wed, 13 Nov 2013 16:43:37 +0000 (16:43 +0000)
committerMaciek Kolbusz <kolbusz@sdf.org>
Wed, 13 Nov 2013 16:43:37 +0000 (16:43 +0000)
src/rrd_fetch_libdbi.c

index 1d6495dead3cbbd56f3e18a5e6ff2a311ba04e4d..35261bbad092dfa1fb8e85e071cd075d38e523bb 100644 (file)
@@ -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;
 }