From ce5dcfbcb93b9143f20614e5e76980a5a5b8c7d7 Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 12 Feb 2005 21:32:01 +0000 Subject: fix up pgsql module after latest changes (typos, etc.) --- ulogd/pgsql/ulogd_PGSQL.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ulogd/pgsql/ulogd_PGSQL.c') 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) -- cgit v1.2.3