summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Renner Berthing <esmil@mailme.dk>2013-01-31 21:05:41 +0100
committerEmil Renner Berthing <esmil@mailme.dk>2013-01-31 21:45:56 +0100
commitd0405824ad63361643f228885902323c47f24f14 (patch)
treea785545f9834642b7a2223772b38a928cab07b82
parentc35f8a57f06d9934e41941219b593196163d9bdd (diff)
downloadlem-postgres-d0405824ad63361643f228885902323c47f24f14.tar.gz
lem-postgres-d0405824ad63361643f228885902323c47f24f14.tar.xz
lem-postgres-d0405824ad63361643f228885902323c47f24f14.zip
set notice receiver to avoid messages on stdout
-rw-r--r--lem/postgres.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lem/postgres.c b/lem/postgres.c
index 44c4c84..43fbf54 100644
--- a/lem/postgres.c
+++ b/lem/postgres.c
@@ -96,6 +96,14 @@ db_close(lua_State *T)
}
static void
+db_notice_receiver(void *arg, const PGresult *res)
+{
+ (void)arg;
+ (void)res;
+ lem_debug("%s", PQresultErrorMessage(res));
+}
+
+static void
postgres_connect_cb(EV_P_ struct ev_io *w, int revents)
{
struct db *d = (struct db *)w;
@@ -163,6 +171,7 @@ postgres_connect(lua_State *T)
lua_setmetatable(T, -2);
d->conn = conn;
+ PQsetNoticeReceiver(conn, db_notice_receiver, NULL);
switch (PQconnectPoll(conn)) {
case PGRES_POLLING_READING: