diff options
author | xrs <xrs@mail36.net> | 2019-10-12 14:37:25 +0200 |
---|---|---|
committer | xrs <xrs@mail36.net> | 2019-10-12 14:37:25 +0200 |
commit | 67d99edb2d7d1f7bece98309caf0c727f02a9f95 (patch) | |
tree | f0d2ce009090ce2d33f0c2653dc62c060e5560bb /src/datacache/plugin_datacache_postgres.c | |
parent | 0a7b9cfe5b351c3c356e81e13b3110c10795ae13 (diff) | |
parent | 195fd08b9f0f46efd63dd87fb8f5fdbaca8ca610 (diff) | |
download | gnunet-67d99edb2d7d1f7bece98309caf0c727f02a9f95.tar.gz gnunet-67d99edb2d7d1f7bece98309caf0c727f02a9f95.zip |
Merge branch 'master' of ssh://git.gnunet.org/gnunet
Diffstat (limited to 'src/datacache/plugin_datacache_postgres.c')
-rw-r--r-- | src/datacache/plugin_datacache_postgres.c | 25 |
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; |