diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-02-05 17:37:02 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-02-05 17:37:08 +0100 |
commit | 0cfa9293a7f7b9b2bad8ac102fd1d3cf0e76a816 (patch) | |
tree | 5d699e9073f6353455b219512f71ec2401ce2f50 | |
parent | 54638eb127fa967972bdbc7e887f12948d037409 (diff) | |
download | gnunet-0cfa9293a7f7b9b2bad8ac102fd1d3cf0e76a816.tar.gz gnunet-0cfa9293a7f7b9b2bad8ac102fd1d3cf0e76a816.zip |
PQ: remove duplicated comments, and send stderr from psql to /dev/null
-rw-r--r-- | src/pq/pq_connect.c | 2 | ||||
-rw-r--r-- | src/pq/pq_eval.c | 59 | ||||
-rw-r--r-- | src/pq/pq_exec.c | 13 |
3 files changed, 1 insertions, 73 deletions
diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c index e8617a5c9..02af17c8c 100644 --- a/src/pq/pq_connect.c +++ b/src/pq/pq_connect.c | |||
@@ -166,7 +166,7 @@ GNUNET_PQ_exec_sql (struct GNUNET_PQ_Context *db, | |||
166 | "Applying SQL file `%s' on database %s\n", | 166 | "Applying SQL file `%s' on database %s\n", |
167 | fn, | 167 | fn, |
168 | db->config_str); | 168 | db->config_str); |
169 | psql = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ERR, | 169 | psql = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_NONE, |
170 | NULL, | 170 | NULL, |
171 | NULL, | 171 | NULL, |
172 | NULL, | 172 | NULL, |
diff --git a/src/pq/pq_eval.c b/src/pq/pq_eval.c index cc16c7864..e31475e13 100644 --- a/src/pq/pq_eval.c +++ b/src/pq/pq_eval.c | |||
@@ -42,19 +42,6 @@ | |||
42 | #define PQ_DIAG_SQLSTATE_SERIALIZATION_FAILURE "40001" | 42 | #define PQ_DIAG_SQLSTATE_SERIALIZATION_FAILURE "40001" |
43 | 43 | ||
44 | 44 | ||
45 | /** | ||
46 | * Check the @a result's error code to see what happened. | ||
47 | * Also logs errors. | ||
48 | * | ||
49 | * @param db database to execute the statement with | ||
50 | * @param statement_name name of the statement that created @a result | ||
51 | * @param result result to check | ||
52 | * @return status code from the result, mapping PQ status | ||
53 | * codes to `enum GNUNET_DB_QueryStatus`. Never | ||
54 | * returns positive values as this function does | ||
55 | * not look at the result set. | ||
56 | * @deprecated (low level, let's see if we can do with just the high-level functions) | ||
57 | */ | ||
58 | enum GNUNET_DB_QueryStatus | 45 | enum GNUNET_DB_QueryStatus |
59 | GNUNET_PQ_eval_result (struct GNUNET_PQ_Context *db, | 46 | GNUNET_PQ_eval_result (struct GNUNET_PQ_Context *db, |
60 | const char *statement_name, | 47 | const char *statement_name, |
@@ -144,22 +131,6 @@ GNUNET_PQ_eval_result (struct GNUNET_PQ_Context *db, | |||
144 | } | 131 | } |
145 | 132 | ||
146 | 133 | ||
147 | /** | ||
148 | * Execute a named prepared @a statement that is NOT a SELECT | ||
149 | * statement in @a connection using the given @a params. Returns the | ||
150 | * resulting session state. | ||
151 | * | ||
152 | * @param db database to execute the statement with | ||
153 | * @param statement_name name of the statement | ||
154 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) | ||
155 | * @return status code from the result, mapping PQ status | ||
156 | * codes to `enum GNUNET_DB_QueryStatus`. If the | ||
157 | * statement was a DELETE or UPDATE statement, the | ||
158 | * number of affected rows is returned.; if the | ||
159 | * statement was an INSERT statement, and no row | ||
160 | * was added due to a UNIQUE violation, we return | ||
161 | * zero; if INSERT was successful, we return one. | ||
162 | */ | ||
163 | enum GNUNET_DB_QueryStatus | 134 | enum GNUNET_DB_QueryStatus |
164 | GNUNET_PQ_eval_prepared_non_select (struct GNUNET_PQ_Context *db, | 135 | GNUNET_PQ_eval_prepared_non_select (struct GNUNET_PQ_Context *db, |
165 | const char *statement_name, | 136 | const char *statement_name, |
@@ -190,21 +161,6 @@ GNUNET_PQ_eval_prepared_non_select (struct GNUNET_PQ_Context *db, | |||
190 | } | 161 | } |
191 | 162 | ||
192 | 163 | ||
193 | /** | ||
194 | * Execute a named prepared @a statement that is a SELECT statement | ||
195 | * which may return multiple results in @a connection using the given | ||
196 | * @a params. Call @a rh with the results. Returns the query | ||
197 | * status including the number of results given to @a rh (possibly zero). | ||
198 | * @a rh will not have been called if the return value is negative. | ||
199 | * | ||
200 | * @param db database to execute the statement with | ||
201 | * @param statement_name name of the statement | ||
202 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) | ||
203 | * @param rh function to call with the result set, NULL to ignore | ||
204 | * @param rh_cls closure to pass to @a rh | ||
205 | * @return status code from the result, mapping PQ status | ||
206 | * codes to `enum GNUNET_DB_QueryStatus`. | ||
207 | */ | ||
208 | enum GNUNET_DB_QueryStatus | 164 | enum GNUNET_DB_QueryStatus |
209 | GNUNET_PQ_eval_prepared_multi_select (struct GNUNET_PQ_Context *db, | 165 | GNUNET_PQ_eval_prepared_multi_select (struct GNUNET_PQ_Context *db, |
210 | const char *statement_name, | 166 | const char *statement_name, |
@@ -239,21 +195,6 @@ GNUNET_PQ_eval_prepared_multi_select (struct GNUNET_PQ_Context *db, | |||
239 | } | 195 | } |
240 | 196 | ||
241 | 197 | ||
242 | /** | ||
243 | * Execute a named prepared @a statement that is a SELECT statement | ||
244 | * which must return a single result in @a connection using the given | ||
245 | * @a params. Stores the result (if any) in @a rs, which the caller | ||
246 | * must then clean up using #GNUNET_PQ_cleanup_result() if the return | ||
247 | * value was #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT. Returns the | ||
248 | * resulting session status. | ||
249 | * | ||
250 | * @param db database to execute the statement with | ||
251 | * @param statement_name name of the statement | ||
252 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) | ||
253 | * @param[in,out] rs result specification to use for storing the result of the query | ||
254 | * @return status code from the result, mapping PQ status | ||
255 | * codes to `enum GNUNET_DB_QueryStatus`. | ||
256 | */ | ||
257 | enum GNUNET_DB_QueryStatus | 198 | enum GNUNET_DB_QueryStatus |
258 | GNUNET_PQ_eval_prepared_singleton_select ( | 199 | GNUNET_PQ_eval_prepared_singleton_select ( |
259 | struct GNUNET_PQ_Context *db, | 200 | struct GNUNET_PQ_Context *db, |
diff --git a/src/pq/pq_exec.c b/src/pq/pq_exec.c index 33fe8733d..1fd8c5068 100644 --- a/src/pq/pq_exec.c +++ b/src/pq/pq_exec.c | |||
@@ -26,12 +26,6 @@ | |||
26 | #include "pq.h" | 26 | #include "pq.h" |
27 | 27 | ||
28 | 28 | ||
29 | /** | ||
30 | * Create a `struct GNUNET_PQ_ExecuteStatement` where errors are fatal. | ||
31 | * | ||
32 | * @param sql actual SQL statement | ||
33 | * @return initialized struct | ||
34 | */ | ||
35 | struct GNUNET_PQ_ExecuteStatement | 29 | struct GNUNET_PQ_ExecuteStatement |
36 | GNUNET_PQ_make_execute (const char *sql) | 30 | GNUNET_PQ_make_execute (const char *sql) |
37 | { | 31 | { |
@@ -44,13 +38,6 @@ GNUNET_PQ_make_execute (const char *sql) | |||
44 | } | 38 | } |
45 | 39 | ||
46 | 40 | ||
47 | /** | ||
48 | * Create a `struct GNUNET_PQ_ExecuteStatement` where errors should | ||
49 | * be tolerated. | ||
50 | * | ||
51 | * @param sql actual SQL statement | ||
52 | * @return initialized struct | ||
53 | */ | ||
54 | struct GNUNET_PQ_ExecuteStatement | 41 | struct GNUNET_PQ_ExecuteStatement |
55 | GNUNET_PQ_make_try_execute (const char *sql) | 42 | GNUNET_PQ_make_try_execute (const char *sql) |
56 | { | 43 | { |