diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-06-01 21:48:19 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-06-01 21:48:19 +0200 |
commit | 1defd30dfeb1867c2756b3fe6a437f695951d0c9 (patch) | |
tree | b48c0fe6bb32469cfcb4284bfac3142e22417ae8 /src/postgres/postgres.c | |
parent | bbbe0b2404d131cc0d9eda26725b65b47a7e073a (diff) |
adding more good helpers to libgnunetpq
Diffstat (limited to 'src/postgres/postgres.c')
-rw-r--r-- | src/postgres/postgres.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/postgres/postgres.c b/src/postgres/postgres.c index 14095c5a44..828842d9d7 100644 --- a/src/postgres/postgres.c +++ b/src/postgres/postgres.c @@ -161,48 +161,6 @@ GNUNET_POSTGRES_prepare_ (PGconn *dbh, /** - * Connect to a postgres database - * - * @param cfg configuration - * @param section configuration section to use to get Postgres configuration options - * @return the postgres handle - */ -PGconn * -GNUNET_POSTGRES_connect (const struct GNUNET_CONFIGURATION_Handle * cfg, - const char *section) -{ - PGconn *dbh; - char *conninfo; - - /* Open database and precompile statements */ - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (cfg, - section, - "CONFIG", - &conninfo)) - conninfo = NULL; - dbh = PQconnectdb (conninfo == NULL ? "" : conninfo); - - if (NULL != dbh) - { - if (PQstatus (dbh) != CONNECTION_OK) - { - GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, - "postgres", - _("Unable to connect to Postgres database '%s': %s\n"), - conninfo, - PQerrorMessage (dbh)); - PQfinish (dbh); - dbh = NULL; - } - } - // FIXME: warn about out-of-memory when dbh is NULL? - GNUNET_free_non_null (conninfo); - return dbh; -} - - -/** * Delete the row identified by the given rowid (qid * in postgres). * |