summaryrefslogtreecommitdiff
path: root/src/pq
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-06-11 01:23:16 +0200
committerChristian Grothoff <christian@grothoff.org>2017-06-11 01:33:02 +0200
commitc90ae1921559d990c179800ac392b0a5358758fb (patch)
treec696cf7e8a8d2f66d24eb221251ab0c05f7c948f /src/pq
parentd71e2f3b35de7fcce36806bdad44ecf4114f6740 (diff)
downloadgnunet-c90ae1921559d990c179800ac392b0a5358758fb.tar.gz
gnunet-c90ae1921559d990c179800ac392b0a5358758fb.zip
rename GNUNET_PQ_QueryStatus to GNUNET_DB_QueryStatus
Diffstat (limited to 'src/pq')
-rw-r--r--src/pq/pq_eval.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/pq/pq_eval.c b/src/pq/pq_eval.c
index b19742bba..0f28aec7e 100644
--- a/src/pq/pq_eval.c
+++ b/src/pq/pq_eval.c
@@ -47,12 +47,12 @@
47 * @param statement_name name of the statement that created @a result 47 * @param statement_name name of the statement that created @a result
48 * @param result result to check 48 * @param result result to check
49 * @return status code from the result, mapping PQ status 49 * @return status code from the result, mapping PQ status
50 * codes to `enum GNUNET_PQ_QueryStatus`. Never 50 * codes to `enum GNUNET_DB_QueryStatus`. Never
51 * returns positive values as this function does 51 * returns positive values as this function does
52 * not look at the result set. 52 * not look at the result set.
53 * @deprecated (low level, let's see if we can do with just the high-level functions) 53 * @deprecated (low level, let's see if we can do with just the high-level functions)
54 */ 54 */
55enum GNUNET_PQ_QueryStatus 55enum GNUNET_DB_QueryStatus
56GNUNET_PQ_eval_result (PGconn *connection, 56GNUNET_PQ_eval_result (PGconn *connection,
57 const char *statement_name, 57 const char *statement_name,
58 PGresult *result) 58 PGresult *result)
@@ -71,7 +71,7 @@ GNUNET_PQ_eval_result (PGconn *connection,
71 { 71 {
72 /* very unexpected... */ 72 /* very unexpected... */
73 GNUNET_break (0); 73 GNUNET_break (0);
74 return GNUNET_PQ_STATUS_HARD_ERROR; 74 return GNUNET_DB_STATUS_HARD_ERROR;
75 } 75 }
76 if ( (0 == strcmp (sqlstate, 76 if ( (0 == strcmp (sqlstate,
77 PQ_DIAG_SQLSTATE_DEADLOCK)) || 77 PQ_DIAG_SQLSTATE_DEADLOCK)) ||
@@ -91,7 +91,7 @@ GNUNET_PQ_eval_result (PGconn *connection,
91 PQresultErrorMessage (result), 91 PQresultErrorMessage (result),
92 PQresStatus (PQresultStatus (result)), 92 PQresStatus (PQresultStatus (result)),
93 PQerrorMessage (connection)); 93 PQerrorMessage (connection));
94 return GNUNET_PQ_STATUS_SOFT_ERROR; 94 return GNUNET_DB_STATUS_SOFT_ERROR;
95 } 95 }
96 if (0 == strcmp (sqlstate, 96 if (0 == strcmp (sqlstate,
97 PQ_DIAG_SQLSTATE_UNIQUE_VIOLATION)) 97 PQ_DIAG_SQLSTATE_UNIQUE_VIOLATION))
@@ -108,7 +108,7 @@ GNUNET_PQ_eval_result (PGconn *connection,
108 PQresultErrorMessage (result), 108 PQresultErrorMessage (result),
109 PQresStatus (PQresultStatus (result)), 109 PQresStatus (PQresultStatus (result)),
110 PQerrorMessage (connection)); 110 PQerrorMessage (connection));
111 return GNUNET_PQ_STATUS_SUCCESS_NO_RESULTS; 111 return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
112 } 112 }
113 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 113 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
114 "pq", 114 "pq",
@@ -121,9 +121,9 @@ GNUNET_PQ_eval_result (PGconn *connection,
121 PQresultErrorMessage (result), 121 PQresultErrorMessage (result),
122 PQresStatus (PQresultStatus (result)), 122 PQresStatus (PQresultStatus (result)),
123 PQerrorMessage (connection)); 123 PQerrorMessage (connection));
124 return GNUNET_PQ_STATUS_HARD_ERROR; 124 return GNUNET_DB_STATUS_HARD_ERROR;
125 } 125 }
126 return GNUNET_PQ_STATUS_SUCCESS_NO_RESULTS; 126 return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
127} 127}
128 128
129 129
@@ -136,20 +136,20 @@ GNUNET_PQ_eval_result (PGconn *connection,
136 * @param statement_name name of the statement 136 * @param statement_name name of the statement
137 * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) 137 * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated)
138 * @return status code from the result, mapping PQ status 138 * @return status code from the result, mapping PQ status
139 * codes to `enum GNUNET_PQ_QueryStatus`. If the 139 * codes to `enum GNUNET_DB_QueryStatus`. If the
140 * statement was a DELETE or UPDATE statement, the 140 * statement was a DELETE or UPDATE statement, the
141 * number of affected rows is returned.; if the 141 * number of affected rows is returned.; if the
142 * statment was an INSERT statement, and no row 142 * statment was an INSERT statement, and no row
143 * was added due to a UNIQUE violation, we return 143 * was added due to a UNIQUE violation, we return
144 * zero; if INSERT was successful, we return one. 144 * zero; if INSERT was successful, we return one.
145 */ 145 */
146enum GNUNET_PQ_QueryStatus 146enum GNUNET_DB_QueryStatus
147GNUNET_PQ_eval_prepared_non_select (PGconn *connection, 147GNUNET_PQ_eval_prepared_non_select (PGconn *connection,
148 const char *statement_name, 148 const char *statement_name,
149 const struct GNUNET_PQ_QueryParam *params) 149 const struct GNUNET_PQ_QueryParam *params)
150{ 150{
151 PGresult *result; 151 PGresult *result;
152 enum GNUNET_PQ_QueryStatus qs; 152 enum GNUNET_DB_QueryStatus qs;
153 153
154 result = GNUNET_PQ_exec_prepared (connection, 154 result = GNUNET_PQ_exec_prepared (connection,
155 statement_name, 155 statement_name,
@@ -157,7 +157,7 @@ GNUNET_PQ_eval_prepared_non_select (PGconn *connection,
157 qs = GNUNET_PQ_eval_result (connection, 157 qs = GNUNET_PQ_eval_result (connection,
158 statement_name, 158 statement_name,
159 result); 159 result);
160 if (GNUNET_PQ_STATUS_SUCCESS_NO_RESULTS == qs) 160 if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
161 { 161 {
162 const char *tuples; 162 const char *tuples;
163 163
@@ -184,9 +184,9 @@ GNUNET_PQ_eval_prepared_non_select (PGconn *connection,
184 * @param rh function to call with the result set, NULL to ignore 184 * @param rh function to call with the result set, NULL to ignore
185 * @param rh_cls closure to pass to @a rh 185 * @param rh_cls closure to pass to @a rh
186 * @return status code from the result, mapping PQ status 186 * @return status code from the result, mapping PQ status
187 * codes to `enum GNUNET_PQ_QueryStatus`. 187 * codes to `enum GNUNET_DB_QueryStatus`.
188 */ 188 */
189enum GNUNET_PQ_QueryStatus 189enum GNUNET_DB_QueryStatus
190GNUNET_PQ_eval_prepared_multi_select (PGconn *connection, 190GNUNET_PQ_eval_prepared_multi_select (PGconn *connection,
191 const char *statement_name, 191 const char *statement_name,
192 const struct GNUNET_PQ_QueryParam *params, 192 const struct GNUNET_PQ_QueryParam *params,
@@ -194,7 +194,7 @@ GNUNET_PQ_eval_prepared_multi_select (PGconn *connection,
194 void *rh_cls) 194 void *rh_cls)
195{ 195{
196 PGresult *result; 196 PGresult *result;
197 enum GNUNET_PQ_QueryStatus qs; 197 enum GNUNET_DB_QueryStatus qs;
198 unsigned int ret; 198 unsigned int ret;
199 199
200 result = GNUNET_PQ_exec_prepared (connection, 200 result = GNUNET_PQ_exec_prepared (connection,
@@ -223,7 +223,7 @@ GNUNET_PQ_eval_prepared_multi_select (PGconn *connection,
223 * which must return a single result in @a connection using the given 223 * which must return a single result in @a connection using the given
224 * @a params. Stores the result (if any) in @a rs, which the caller 224 * @a params. Stores the result (if any) in @a rs, which the caller
225 * must then clean up using #GNUNET_PQ_cleanup_result() if the return 225 * must then clean up using #GNUNET_PQ_cleanup_result() if the return
226 * value was #GNUNET_PQ_STATUS_SUCCESS_ONE_RESULT. Returns the 226 * value was #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT. Returns the
227 * resulting session status. 227 * resulting session status.
228 * 228 *
229 * @param connection connection to execute the statement in 229 * @param connection connection to execute the statement in
@@ -231,16 +231,16 @@ GNUNET_PQ_eval_prepared_multi_select (PGconn *connection,
231 * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) 231 * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated)
232 * @param[in,out] rs result specification to use for storing the result of the query 232 * @param[in,out] rs result specification to use for storing the result of the query
233 * @return status code from the result, mapping PQ status 233 * @return status code from the result, mapping PQ status
234 * codes to `enum GNUNET_PQ_QueryStatus`. 234 * codes to `enum GNUNET_DB_QueryStatus`.
235 */ 235 */
236enum GNUNET_PQ_QueryStatus 236enum GNUNET_DB_QueryStatus
237GNUNET_PQ_eval_prepared_singleton_select (PGconn *connection, 237GNUNET_PQ_eval_prepared_singleton_select (PGconn *connection,
238 const char *statement_name, 238 const char *statement_name,
239 const struct GNUNET_PQ_QueryParam *params, 239 const struct GNUNET_PQ_QueryParam *params,
240 struct GNUNET_PQ_ResultSpec *rs) 240 struct GNUNET_PQ_ResultSpec *rs)
241{ 241{
242 PGresult *result; 242 PGresult *result;
243 enum GNUNET_PQ_QueryStatus qs; 243 enum GNUNET_DB_QueryStatus qs;
244 244
245 result = GNUNET_PQ_exec_prepared (connection, 245 result = GNUNET_PQ_exec_prepared (connection,
246 statement_name, 246 statement_name,
@@ -256,14 +256,14 @@ GNUNET_PQ_eval_prepared_singleton_select (PGconn *connection,
256 if (0 == PQntuples (result)) 256 if (0 == PQntuples (result))
257 { 257 {
258 PQclear (result); 258 PQclear (result);
259 return GNUNET_PQ_STATUS_SUCCESS_NO_RESULTS; 259 return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
260 } 260 }
261 if (1 != PQntuples (result)) 261 if (1 != PQntuples (result))
262 { 262 {
263 /* more than one result, but there must be at most one */ 263 /* more than one result, but there must be at most one */
264 GNUNET_break (0); 264 GNUNET_break (0);
265 PQclear (result); 265 PQclear (result);
266 return GNUNET_PQ_STATUS_HARD_ERROR; 266 return GNUNET_DB_STATUS_HARD_ERROR;
267 } 267 }
268 if (GNUNET_OK != 268 if (GNUNET_OK !=
269 GNUNET_PQ_extract_result (result, 269 GNUNET_PQ_extract_result (result,
@@ -271,10 +271,10 @@ GNUNET_PQ_eval_prepared_singleton_select (PGconn *connection,
271 0)) 271 0))
272 { 272 {
273 PQclear (result); 273 PQclear (result);
274 return GNUNET_PQ_STATUS_HARD_ERROR; 274 return GNUNET_DB_STATUS_HARD_ERROR;
275 } 275 }
276 PQclear (result); 276 PQclear (result);
277 return GNUNET_PQ_STATUS_SUCCESS_ONE_RESULT; 277 return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
278} 278}
279 279
280 280