aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-10-11 20:55:59 +0200
committerChristian Grothoff <christian@grothoff.org>2019-10-11 23:36:09 +0200
commite3e21acb23283915c97e6ef1c167325f4592665c (patch)
treed6b677c2f53ffd8253b97be26bcf3a4301f69269 /src/datastore
parent8ed3ad85fa8c0faa213157610379d69875b10ccb (diff)
downloadgnunet-e3e21acb23283915c97e6ef1c167325f4592665c.tar.gz
gnunet-e3e21acb23283915c97e6ef1c167325f4592665c.zip
libgnunetpq API change to fix #5733
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/plugin_datastore_postgres.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 181cf8cf8..0811edfd7 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -54,7 +54,7 @@ struct Plugin
54 /** 54 /**
55 * Native Postgres database handle. 55 * Native Postgres database handle.
56 */ 56 */
57 PGconn *dbh; 57 struct GNUNET_PQ_Context *dbh;
58}; 58};
59 59
60 60
@@ -172,21 +172,11 @@ init_connection (struct Plugin *plugin)
172#undef RESULT_COLUMNS 172#undef RESULT_COLUMNS
173 173
174 plugin->dbh = GNUNET_PQ_connect_with_cfg (plugin->env->cfg, 174 plugin->dbh = GNUNET_PQ_connect_with_cfg (plugin->env->cfg,
175 "datastore-postgres"); 175 "datastore-postgres",
176 es,
177 ps);
176 if (NULL == plugin->dbh) 178 if (NULL == plugin->dbh)
177 return GNUNET_SYSERR; 179 return GNUNET_SYSERR;
178
179 if ((GNUNET_OK !=
180 GNUNET_PQ_exec_statements (plugin->dbh,
181 es)) ||
182 (GNUNET_OK !=
183 GNUNET_PQ_prepare_statements (plugin->dbh,
184 ps)))
185 {
186 PQfinish (plugin->dbh);
187 plugin->dbh = NULL;
188 return GNUNET_SYSERR;
189 }
190 return GNUNET_OK; 180 return GNUNET_OK;
191} 181}
192 182
@@ -974,7 +964,7 @@ libgnunet_plugin_datastore_postgres_done (void *cls)
974 struct GNUNET_DATASTORE_PluginFunctions *api = cls; 964 struct GNUNET_DATASTORE_PluginFunctions *api = cls;
975 struct Plugin *plugin = api->cls; 965 struct Plugin *plugin = api->cls;
976 966
977 PQfinish (plugin->dbh); 967 GNUNET_PQ_disconnect (plugin->dbh);
978 GNUNET_free (plugin); 968 GNUNET_free (plugin);
979 GNUNET_free (api); 969 GNUNET_free (api);
980 return NULL; 970 return NULL;