aboutsummaryrefslogtreecommitdiff
path: root/src/pq/pq.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pq/pq.c')
-rw-r--r--src/pq/pq.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/pq/pq.c b/src/pq/pq.c
index e9c960e33..25202a640 100644
--- a/src/pq/pq.c
+++ b/src/pq/pq.c
@@ -133,34 +133,31 @@ GNUNET_PQ_extract_result (PGresult *result,
133 for (unsigned int i = 0; NULL != rs[i].conv; i++) 133 for (unsigned int i = 0; NULL != rs[i].conv; i++)
134 { 134 {
135 struct GNUNET_PQ_ResultSpec *spec; 135 struct GNUNET_PQ_ResultSpec *spec;
136 int ret; 136 enum GNUNET_GenericReturnValue ret;
137 137
138 spec = &rs[i]; 138 spec = &rs[i];
139 if (spec->is_nullable)
140 {
141 int fnum;
142
143 fnum = PQfnumber (result,
144 spec->fname);
145 if (PQgetisnull (result,
146 row,
147 fnum))
148 {
149 if (NULL != spec->is_null)
150 *spec->is_null = true;
151 continue;
152 }
153 if (NULL != spec->is_null)
154 *spec->is_null = false;
155 }
156 ret = spec->conv (spec->cls, 139 ret = spec->conv (spec->cls,
157 result, 140 result,
158 row, 141 row,
159 spec->fname, 142 spec->fname,
160 &spec->dst_size, 143 &spec->dst_size,
161 spec->dst); 144 spec->dst);
162 if (GNUNET_OK != ret) 145 switch (ret)
163 { 146 {
147 case GNUNET_OK:
148 /* canonical case, continue below */
149 if (NULL != spec->is_null)
150 *spec->is_null = false;
151 break;
152 case GNUNET_NO:
153 if (spec->is_nullable)
154 {
155 if (NULL != spec->is_null)
156 *spec->is_null = true;
157 continue;
158 }
159 /* intentional fall-through: NULL value for field that is NOT nullable */
160 case GNUNET_SYSERR:
164 for (unsigned int j = 0; j < i; j++) 161 for (unsigned int j = 0; j < i; j++)
165 if (NULL != rs[j].cleaner) 162 if (NULL != rs[j].cleaner)
166 rs[j].cleaner (rs[j].cls, 163 rs[j].cleaner (rs[j].cls,