aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-09-28 09:45:26 +0000
committerChristian Grothoff <christian@grothoff.org>2012-09-28 09:45:26 +0000
commit9d7c31dff02f838f635710ad6156e286afbec3f1 (patch)
treee72656c479bbecb3163cd1172a627f8400f1f03e /src/namestore
parent1543f694845cf42109b04554f1896a3563de539c (diff)
downloadgnunet-9d7c31dff02f838f635710ad6156e286afbec3f1.tar.gz
gnunet-9d7c31dff02f838f635710ad6156e286afbec3f1.zip
-simplify
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-service-namestore.c2
-rw-r--r--src/namestore/plugin_namestore_postgres.c14
2 files changed, 7 insertions, 9 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 1c3edaa81..bd32d7155 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1718,7 +1718,7 @@ enum ZoneIterationResult
1718 /** 1718 /**
1719 * Iteration complete 1719 * Iteration complete
1720 */ 1720 */
1721 IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE = 1, 1721 IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE = 1
1722}; 1722};
1723 1723
1724 1724
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 214727f7c..3cddc952d 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -164,11 +164,10 @@ database_setup (struct Plugin *plugin)
164 create_indices (plugin->dbh); 164 create_indices (plugin->dbh);
165 PQclear (res); 165 PQclear (res);
166 166
167#define ALL "zone_key, record_name, record_count, record_data, block_expiration_time, signature"
168 if ((GNUNET_OK != 167 if ((GNUNET_OK !=
169 GNUNET_POSTGRES_prepare (plugin->dbh, 168 GNUNET_POSTGRES_prepare (plugin->dbh,
170 "put_records", 169 "put_records",
171 "INSERT INTO ns091records (" ALL 170 "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature"
172 ", zone_delegation, zone_hash, record_name_hash, rvalue) VALUES " 171 ", zone_delegation, zone_hash, record_name_hash, rvalue) VALUES "
173 "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", 10)) || 172 "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", 10)) ||
174 (GNUNET_OK != 173 (GNUNET_OK !=
@@ -178,27 +177,27 @@ database_setup (struct Plugin *plugin)
178 (GNUNET_OK != 177 (GNUNET_OK !=
179 GNUNET_POSTGRES_prepare (plugin->dbh, 178 GNUNET_POSTGRES_prepare (plugin->dbh,
180 "iterate_records", 179 "iterate_records",
181 "SELECT " ALL 180 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
182 " FROM ns091records WHERE zone_hash=$1 AND record_name_hash=$2 ORDER BY rvalue LIMIT 1 OFFSET $3", 3)) || 181 " FROM ns091records WHERE zone_hash=$1 AND record_name_hash=$2 ORDER BY rvalue LIMIT 1 OFFSET $3", 3)) ||
183 (GNUNET_OK != 182 (GNUNET_OK !=
184 GNUNET_POSTGRES_prepare (plugin->dbh, 183 GNUNET_POSTGRES_prepare (plugin->dbh,
185 "iterate_by_zone", 184 "iterate_by_zone",
186 "SELECT " ALL 185 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
187 " FROM ns091records WHERE zone_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || 186 " FROM ns091records WHERE zone_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) ||
188 (GNUNET_OK != 187 (GNUNET_OK !=
189 GNUNET_POSTGRES_prepare (plugin->dbh, 188 GNUNET_POSTGRES_prepare (plugin->dbh,
190 "iterate_by_name", 189 "iterate_by_name",
191 "SELECT " ALL 190 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
192 " FROM ns091records WHERE record_name_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || 191 " FROM ns091records WHERE record_name_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) ||
193 (GNUNET_OK != 192 (GNUNET_OK !=
194 GNUNET_POSTGRES_prepare (plugin->dbh, 193 GNUNET_POSTGRES_prepare (plugin->dbh,
195 "iterate_all", 194 "iterate_all",
196 "SELECT " ALL 195 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
197 " FROM ns091records ORDER BY rvalue LIMIT 1 OFFSET $1", 1)) || 196 " FROM ns091records ORDER BY rvalue LIMIT 1 OFFSET $1", 1)) ||
198 (GNUNET_OK != 197 (GNUNET_OK !=
199 GNUNET_POSTGRES_prepare (plugin->dbh, 198 GNUNET_POSTGRES_prepare (plugin->dbh,
200 "zone_to_name", 199 "zone_to_name",
201 "SELECT " ALL 200 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
202 " FROM ns091records WHERE zone_hash=$1 AND zone_delegation=$2", 2)) || 201 " FROM ns091records WHERE zone_hash=$1 AND zone_delegation=$2", 2)) ||
203 (GNUNET_OK != 202 (GNUNET_OK !=
204 GNUNET_POSTGRES_prepare (plugin->dbh, 203 GNUNET_POSTGRES_prepare (plugin->dbh,
@@ -209,7 +208,6 @@ database_setup (struct Plugin *plugin)
209 plugin->dbh = NULL; 208 plugin->dbh = NULL;
210 return GNUNET_SYSERR; 209 return GNUNET_SYSERR;
211 } 210 }
212#undef ALL
213 return GNUNET_OK; 211 return GNUNET_OK;
214} 212}
215 213