aboutsummaryrefslogtreecommitdiff
path: root/src/pq
diff options
context:
space:
mode:
Diffstat (limited to 'src/pq')
-rw-r--r--src/pq/pq.c8
-rw-r--r--src/pq/pq_exec.c5
-rw-r--r--src/pq/pq_result_helper.c43
3 files changed, 38 insertions, 18 deletions
diff --git a/src/pq/pq.c b/src/pq/pq.c
index b260aa1db..130ff355f 100644
--- a/src/pq/pq.c
+++ b/src/pq/pq.c
@@ -95,6 +95,11 @@ GNUNET_PQ_exec_prepared (struct GNUNET_PQ_Context *db,
95 param_lengths, 95 param_lengths,
96 param_formats, 96 param_formats,
97 1); 97 1);
98 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
99 "pq",
100 "Execution of prepared SQL statement `%s' finished (%d)\n",
101 name,
102 PGRES_COMMAND_OK == PQresultStatus (res));
98 if ( (PGRES_COMMAND_OK != PQresultStatus (res)) && 103 if ( (PGRES_COMMAND_OK != PQresultStatus (res)) &&
99 (CONNECTION_OK != (status = PQstatus (db->conn))) ) 104 (CONNECTION_OK != (status = PQstatus (db->conn))) )
100 { 105 {
@@ -163,6 +168,9 @@ GNUNET_PQ_extract_result (PGresult *result,
163 spec->fname); 168 spec->fname);
164 goto cleanup; 169 goto cleanup;
165 case GNUNET_SYSERR: 170 case GNUNET_SYSERR:
171 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
172 "Failed to extract field `%s'\n",
173 spec->fname);
166 GNUNET_break (0); 174 GNUNET_break (0);
167 goto cleanup; 175 goto cleanup;
168 } 176 }
diff --git a/src/pq/pq_exec.c b/src/pq/pq_exec.c
index 464fff4b4..dcde331b6 100644
--- a/src/pq/pq_exec.c
+++ b/src/pq/pq_exec.c
@@ -86,6 +86,11 @@ GNUNET_PQ_exec_statements (struct GNUNET_PQ_Context *db,
86 db); 86 db);
87 result = PQexec (db->conn, 87 result = PQexec (db->conn,
88 es[i].sql); 88 es[i].sql);
89 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
90 "Running statement `%s' on %p finished (%d)\n",
91 es[i].sql,
92 db,
93 PGRES_COMMAND_OK == PQresultStatus (result));
89 if ((GNUNET_NO == es[i].ignore_errors) && 94 if ((GNUNET_NO == es[i].ignore_errors) &&
90 (PGRES_COMMAND_OK != PQresultStatus (result))) 95 (PGRES_COMMAND_OK != PQresultStatus (result)))
91 { 96 {
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index 23fb4f96e..f264603f4 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -127,10 +127,13 @@ GNUNET_PQ_result_spec_variable_size (const char *name,
127 void **dst, 127 void **dst,
128 size_t *sptr) 128 size_t *sptr)
129{ 129{
130 struct GNUNET_PQ_ResultSpec res = 130 struct GNUNET_PQ_ResultSpec res = {
131 { &extract_varsize_blob, 131 .conv = &extract_varsize_blob,
132 &clean_varsize_blob, NULL, 132 .cleaner = &clean_varsize_blob,
133 (void *) (dst), 0, name, sptr }; 133 .dst = (void *) (dst),
134 .fname = name,
135 .result_size = sptr
136 };
134 137
135 return res; 138 return res;
136} 139}
@@ -207,10 +210,12 @@ GNUNET_PQ_result_spec_fixed_size (const char *name,
207 void *dst, 210 void *dst,
208 size_t dst_size) 211 size_t dst_size)
209{ 212{
210 struct GNUNET_PQ_ResultSpec res = 213 struct GNUNET_PQ_ResultSpec res = {
211 { &extract_fixed_blob, 214 .conv = &extract_fixed_blob,
212 NULL, NULL, 215 .dst = (dst),
213 (dst), dst_size, name, NULL }; 216 .dst_size = dst_size,
217 .fname = name
218 };
214 219
215 return res; 220 return res;
216} 221}
@@ -301,11 +306,12 @@ struct GNUNET_PQ_ResultSpec
301GNUNET_PQ_result_spec_rsa_public_key (const char *name, 306GNUNET_PQ_result_spec_rsa_public_key (const char *name,
302 struct GNUNET_CRYPTO_RsaPublicKey **rsa) 307 struct GNUNET_CRYPTO_RsaPublicKey **rsa)
303{ 308{
304 struct GNUNET_PQ_ResultSpec res = 309 struct GNUNET_PQ_ResultSpec res = {
305 { &extract_rsa_public_key, 310 .conv = &extract_rsa_public_key,
306 &clean_rsa_public_key, 311 .cleaner = &clean_rsa_public_key,
307 NULL, 312 .dst = (void *) rsa,
308 (void *) rsa, 0, name, NULL }; 313 .fname = name
314 };
309 315
310 return res; 316 return res;
311} 317}
@@ -395,11 +401,12 @@ struct GNUNET_PQ_ResultSpec
395GNUNET_PQ_result_spec_rsa_signature (const char *name, 401GNUNET_PQ_result_spec_rsa_signature (const char *name,
396 struct GNUNET_CRYPTO_RsaSignature **sig) 402 struct GNUNET_CRYPTO_RsaSignature **sig)
397{ 403{
398 struct GNUNET_PQ_ResultSpec res = 404 struct GNUNET_PQ_ResultSpec res = {
399 { &extract_rsa_signature, 405 .conv = &extract_rsa_signature,
400 &clean_rsa_signature, 406 .cleaner = &clean_rsa_signature,
401 NULL, 407 .dst = (void *) sig,
402 (void *) sig, 0, (name), NULL }; 408 .fname = name
409 };
403 410
404 return res; 411 return res;
405} 412}