aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/plugin_namestore_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/plugin_namestore_postgres.c')
-rw-r--r--src/namestore/plugin_namestore_postgres.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 1daf0c7c1..0df6aa413 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -113,7 +113,28 @@ database_setup (struct Plugin *plugin)
113 "namestore-postgres"); 113 "namestore-postgres");
114 if (NULL == plugin->dbh) 114 if (NULL == plugin->dbh)
115 return GNUNET_SYSERR; 115 return GNUNET_SYSERR;
116 res = 116 if (GNUNET_YES ==
117 GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg,
118 "namestore-postgres",
119 "TEMPORARY_TABLE"))
120 {
121 res =
122 PQexec (plugin->dbh,
123 "CREATE TEMPORARY TABLE ns091records ("
124 " zone_key BYTEA NOT NULL DEFAULT '',"
125 " zone_delegation BYTEA NOT NULL DEFAULT '',"
126 " zone_hash BYTEA NOT NULL DEFAULT '',"
127 " record_count INTEGER NOT NULL DEFAULT 0,"
128 " record_data BYTEA NOT NULL DEFAULT '',"
129 " block_expiration_time BIGINT NOT NULL DEFAULT 0,"
130 " signature BYTEA NOT NULL DEFAULT '',"
131 " record_name TEXT NOT NULL DEFAULT '',"
132 " record_name_hash BYTEA NOT NULL DEFAULT '',"
133 " rvalue BIGINT NOT NULL DEFAULT 0"
134 ")" "WITH OIDS");
135 }
136 else
137 res =
117 PQexec (plugin->dbh, 138 PQexec (plugin->dbh,
118 "CREATE TABLE ns091records (" 139 "CREATE TABLE ns091records ("
119 " zone_key BYTEA NOT NULL DEFAULT ''," 140 " zone_key BYTEA NOT NULL DEFAULT '',"
@@ -127,6 +148,7 @@ database_setup (struct Plugin *plugin)
127 " record_name_hash BYTEA NOT NULL DEFAULT ''," 148 " record_name_hash BYTEA NOT NULL DEFAULT '',"
128 " rvalue BIGINT NOT NULL DEFAULT 0" 149 " rvalue BIGINT NOT NULL DEFAULT 0"
129 ")" "WITH OIDS"); 150 ")" "WITH OIDS");
151
130 if ((NULL == res) || ((PQresultStatus (res) != PGRES_COMMAND_OK) && (0 != strcmp ("42P07", /* duplicate table */ 152 if ((NULL == res) || ((PQresultStatus (res) != PGRES_COMMAND_OK) && (0 != strcmp ("42P07", /* duplicate table */
131 PQresultErrorField 153 PQresultErrorField
132 (res, 154 (res,
@@ -380,6 +402,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
380 LOG (GNUNET_ERROR_TYPE_DEBUG, 402 LOG (GNUNET_ERROR_TYPE_DEBUG,
381 "Ending iteration (no more results)\n"); 403 "Ending iteration (no more results)\n");
382 PQclear (res); 404 PQclear (res);
405 iter (iter_cls, NULL, GNUNET_TIME_UNIT_ZERO_ABS, NULL, 0, NULL, NULL);
383 return GNUNET_NO; 406 return GNUNET_NO;
384 } 407 }
385 GNUNET_assert (1 == cnt); 408 GNUNET_assert (1 == cnt);