Added support for barometer sensor BMP085 from Bosch
[collectd.git] / src / mysql.c
index 670179b..a6b1e5e 100644 (file)
@@ -64,7 +64,6 @@ struct mysql_database_s /* {{{ */
 };
 typedef struct mysql_database_s mysql_database_t; /* }}} */
 
-struct st_mysql_options *options;
 static int mysql_read (user_data_t *ud);
 
 void mysql_read_default_options(struct st_mysql_options *options,
@@ -274,8 +273,8 @@ static MYSQL *getconnection (mysql_database_t *db)
                }
        }
 
-       options->connect_timeout = db->timeout;
-       mysql_read_default_options(options, NULL, NULL);
+       /* Configure TCP connect timeout (default: 0) */
+       db->con->options.connect_timeout = db->timeout;
 
        if (mysql_real_connect (db->con, db->host, db->user, db->pass,
                                db->database, db->port, db->socket, 0) == NULL)
@@ -305,6 +304,7 @@ static void set_host (mysql_database_t *db, char *buf, size_t buflen)
                sstrncpy (buf, db->alias, buflen);
        else if ((db->host == NULL)
                        || (strcmp ("", db->host) == 0)
+                       || (strcmp ("127.0.0.1", db->host) == 0)
                        || (strcmp ("localhost", db->host) == 0))
                sstrncpy (buf, hostname_g, buflen);
        else
@@ -552,7 +552,7 @@ static int mysql_read_slave_stats (mysql_database_t *db, MYSQL *con)
                        ssnprintf (n.message, sizeof (n.message),
                                        "slave SQL thread started");
                        plugin_dispatch_notification (&n);
-                       db->slave_sql_running = 0;
+                       db->slave_sql_running = 1;
                }
        }