aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2023-02-06 12:59:49 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2023-02-06 12:59:49 +0900
commitb2f9db3b8f7a7553ee94c811e567e286a6db4f54 (patch)
tree4ac8077eef36de6cb511ea674199a4476ecc7d2b
parentb5f164ddc666e50c38b68938fcec428d72788ba4 (diff)
parentcfa61f12efe97933fb1e5ddda29873698f154f95 (diff)
downloadgnunet-0.19.3.tar.gz
gnunet-0.19.3.zip
Merge branch 'master' of git+ssh://git.gnunet.org/gnunetv0.19.3
-rw-r--r--src/pq/pq_connect.c2
-rw-r--r--src/pq/pq_eval.c59
-rw-r--r--src/pq/pq_event.c2
-rw-r--r--src/pq/pq_exec.c13
4 files changed, 2 insertions, 74 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 */
58enum GNUNET_DB_QueryStatus 45enum GNUNET_DB_QueryStatus
59GNUNET_PQ_eval_result (struct GNUNET_PQ_Context *db, 46GNUNET_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 */
163enum GNUNET_DB_QueryStatus 134enum GNUNET_DB_QueryStatus
164GNUNET_PQ_eval_prepared_non_select (struct GNUNET_PQ_Context *db, 135GNUNET_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 */
208enum GNUNET_DB_QueryStatus 164enum GNUNET_DB_QueryStatus
209GNUNET_PQ_eval_prepared_multi_select (struct GNUNET_PQ_Context *db, 165GNUNET_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 */
257enum GNUNET_DB_QueryStatus 198enum GNUNET_DB_QueryStatus
258GNUNET_PQ_eval_prepared_singleton_select ( 199GNUNET_PQ_eval_prepared_singleton_select (
259 struct GNUNET_PQ_Context *db, 200 struct GNUNET_PQ_Context *db,
diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c
index 6dbacf7ff..3e708fc04 100644
--- a/src/pq/pq_event.c
+++ b/src/pq/pq_event.c
@@ -525,7 +525,7 @@ GNUNET_PG_get_event_notify_channel (const struct GNUNET_DB_EventHeaderP *es)
525 char *end; 525 char *end;
526 526
527 end = stpcpy (sql, 527 end = stpcpy (sql,
528 "NOTIFY X"); 528 "X");
529 end = es_to_channel (es, 529 end = es_to_channel (es,
530 end); 530 end);
531 GNUNET_assert (NULL != end); 531 GNUNET_assert (NULL != end);
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 */
35struct GNUNET_PQ_ExecuteStatement 29struct GNUNET_PQ_ExecuteStatement
36GNUNET_PQ_make_execute (const char *sql) 30GNUNET_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 */
54struct GNUNET_PQ_ExecuteStatement 41struct GNUNET_PQ_ExecuteStatement
55GNUNET_PQ_make_try_execute (const char *sql) 42GNUNET_PQ_make_try_execute (const char *sql)
56{ 43{