summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4cca3a1)
raw | patch | inline | side by side (parent: 4cca3a1)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 14 Oct 2008 11:41:18 +0000 (13:41 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Thu, 16 Oct 2008 08:28:59 +0000 (10:28 +0200) |
When reinitializing the plugin a new connection to all databases has been
opened. Now, we check if the connection already exists. In that case no new
connection will be opened but the existing connection will be pinged instead.
Thanks to Admin <collectd-info@internode.com.au> for finding and reporting
this.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
opened. Now, we check if the connection already exists. In that case no new
connection will be opened but the existing connection will be pinged instead.
Thanks to Admin <collectd-info@internode.com.au> for finding and reporting
this.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/postgresql.c | patch | blob | history |
diff --git a/src/postgresql.c b/src/postgresql.c
index 9959690a1ad8553c1f40567a8dc14778f3052ac7..90e9f5db606ddcec80868e2225d8051f113221f4 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
static void c_psql_database_delete (c_psql_database_t *db)
{
PQfinish (db->conn);
+ db->conn = NULL;
sfree (db->queries);
db->queries_num = 0;
int j;
+ /* this will happen during reinitialization */
+ if (NULL != db->conn) {
+ c_psql_check_connection (db);
+ continue;
+ }
+
status = ssnprintf (buf, buf_len, "dbname = '%s'", db->database);
if (0 < status) {
buf += status;