summaryrefslogtreecommitdiff
path: root/src/datacache/plugin_datacache_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datacache/plugin_datacache_postgres.c')
-rw-r--r--src/datacache/plugin_datacache_postgres.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index 59dff9067..c532550ae 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -48,7 +48,7 @@ struct Plugin
48 /** 48 /**
49 * Native Postgres database handle. 49 * Native Postgres database handle.
50 */ 50 */
51 PGconn *dbh; 51 struct GNUNET_PQ_Context *dbh;
52 52
53 /** 53 /**
54 * Number of key-value pairs in the database. 54 * Number of key-value pairs in the database.
@@ -122,26 +122,11 @@ init_connection (struct Plugin *plugin)
122 }; 122 };
123 123
124 plugin->dbh = GNUNET_PQ_connect_with_cfg (plugin->env->cfg, 124 plugin->dbh = GNUNET_PQ_connect_with_cfg (plugin->env->cfg,
125 "datacache-postgres"); 125 "datacache-postgres",
126 es,
127 ps);
126 if (NULL == plugin->dbh) 128 if (NULL == plugin->dbh)
127 return GNUNET_SYSERR; 129 return GNUNET_SYSERR;
128 if (GNUNET_OK !=
129 GNUNET_PQ_exec_statements (plugin->dbh,
130 es))
131 {
132 PQfinish (plugin->dbh);
133 plugin->dbh = NULL;
134 return GNUNET_SYSERR;
135 }
136
137 if (GNUNET_OK !=
138 GNUNET_PQ_prepare_statements (plugin->dbh,
139 ps))
140 {
141 PQfinish (plugin->dbh);
142 plugin->dbh = NULL;
143 return GNUNET_SYSERR;
144 }
145 return GNUNET_OK; 130 return GNUNET_OK;
146} 131}
147 132
@@ -710,7 +695,7 @@ libgnunet_plugin_datacache_postgres_done (void *cls)
710 struct GNUNET_DATACACHE_PluginFunctions *api = cls; 695 struct GNUNET_DATACACHE_PluginFunctions *api = cls;
711 struct Plugin *plugin = api->cls; 696 struct Plugin *plugin = api->cls;
712 697
713 PQfinish (plugin->dbh); 698 GNUNET_PQ_disconnect (plugin->dbh);
714 GNUNET_free (plugin); 699 GNUNET_free (plugin);
715 GNUNET_free (api); 700 GNUNET_free (api);
716 return NULL; 701 return NULL;