summaryrefslogtreecommitdiffstats
path: root/ulogd/pgsql/ulogd_PGSQL.c
diff options
context:
space:
mode:
authorlaforge <laforge>2005-02-12 21:32:01 +0000
committerlaforge <laforge>2005-02-12 21:32:01 +0000
commitce5dcfbcb93b9143f20614e5e76980a5a5b8c7d7 (patch)
tree758b23e298e4e47eebaea07af6a76fefd1795a10 /ulogd/pgsql/ulogd_PGSQL.c
parent1ea34e920098d96053fd0bb5a9f7f47dfc96bf80 (diff)
fix up pgsql module after latest changes (typos, etc.)
Diffstat (limited to 'ulogd/pgsql/ulogd_PGSQL.c')
-rw-r--r--ulogd/pgsql/ulogd_PGSQL.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ulogd/pgsql/ulogd_PGSQL.c b/ulogd/pgsql/ulogd_PGSQL.c
index 0c1f698..74392a3 100644
--- a/ulogd/pgsql/ulogd_PGSQL.c
+++ b/ulogd/pgsql/ulogd_PGSQL.c
@@ -241,7 +241,7 @@ static int pgsql_createstmt(void)
return 0;
}
-#define PGSQL_GETCOLUMN_TEMPLATE "SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname ='%s' AND a.attnum>0 AND a.attrelid=c.oid ORDER BY a.attnum
+#define PGSQL_GETCOLUMN_TEMPLATE "SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname ='%s' AND a.attnum>0 AND a.attrelid=c.oid ORDER BY a.attnum"
/* find out which columns the table has */
static int pgsql_get_columns(const char *table)
@@ -257,7 +257,7 @@ static int pgsql_get_columns(const char *table)
if (!dbh)
return 1;
- snprintf(pgbuf, sizeof(pgbuf)-1, "SELECT a.attname FROM pg_class c, pg_attribute a WHERE c.relname ='%s' AND a.attnum>0 AND a.attrelid=c.oid ORDER BY a.attnum", table);
+ snprintf(pgbuf, sizeof(pgbuf)-1, PGSQL_GETCOLUMN_TEMPLATE, table);
ulogd_log(ULOGD_DEBUG, pgbuf);
result = PQexec(dbh, pgbuf);
@@ -369,15 +369,17 @@ static int pgsql_init(void)
if (pgsql_open_db(host_ce.u.string, port_ce.u.value, user_ce.u.string,
pass_ce.u.string, db_ce.u.string)) {
ulogd_log(ULOGD_ERROR, "can't establish database connection\n");
- return;
+ return 1;
}
/* read the fieldnames to know which values to insert */
if (pgsql_get_columns(table_ce.u.string)) {
ulogd_log(ULOGD_ERROR, "unable to get pgsql columns\n");
- return;
+ return 1;
}
pgsql_createstmt();
+
+ return 0;
}
static void pgsql_fini(void)