From 0cfa9293a7f7b9b2bad8ac102fd1d3cf0e76a816 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Feb 2023 17:37:02 +0100 Subject: PQ: remove duplicated comments, and send stderr from psql to /dev/null --- src/pq/pq_connect.c | 2 +- src/pq/pq_eval.c | 59 ----------------------------------------------------- src/pq/pq_exec.c | 13 ------------ 3 files changed, 1 insertion(+), 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, "Applying SQL file `%s' on database %s\n", fn, db->config_str); - psql = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ERR, + psql = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_NONE, NULL, NULL, 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 @@ #define PQ_DIAG_SQLSTATE_SERIALIZATION_FAILURE "40001" -/** - * Check the @a result's error code to see what happened. - * Also logs errors. - * - * @param db database to execute the statement with - * @param statement_name name of the statement that created @a result - * @param result result to check - * @return status code from the result, mapping PQ status - * codes to `enum GNUNET_DB_QueryStatus`. Never - * returns positive values as this function does - * not look at the result set. - * @deprecated (low level, let's see if we can do with just the high-level functions) - */ enum GNUNET_DB_QueryStatus GNUNET_PQ_eval_result (struct GNUNET_PQ_Context *db, const char *statement_name, @@ -144,22 +131,6 @@ GNUNET_PQ_eval_result (struct GNUNET_PQ_Context *db, } -/** - * Execute a named prepared @a statement that is NOT a SELECT - * statement in @a connection using the given @a params. Returns the - * resulting session state. - * - * @param db database to execute the statement with - * @param statement_name name of the statement - * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) - * @return status code from the result, mapping PQ status - * codes to `enum GNUNET_DB_QueryStatus`. If the - * statement was a DELETE or UPDATE statement, the - * number of affected rows is returned.; if the - * statement was an INSERT statement, and no row - * was added due to a UNIQUE violation, we return - * zero; if INSERT was successful, we return one. - */ enum GNUNET_DB_QueryStatus GNUNET_PQ_eval_prepared_non_select (struct GNUNET_PQ_Context *db, const char *statement_name, @@ -190,21 +161,6 @@ GNUNET_PQ_eval_prepared_non_select (struct GNUNET_PQ_Context *db, } -/** - * Execute a named prepared @a statement that is a SELECT statement - * which may return multiple results in @a connection using the given - * @a params. Call @a rh with the results. Returns the query - * status including the number of results given to @a rh (possibly zero). - * @a rh will not have been called if the return value is negative. - * - * @param db database to execute the statement with - * @param statement_name name of the statement - * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) - * @param rh function to call with the result set, NULL to ignore - * @param rh_cls closure to pass to @a rh - * @return status code from the result, mapping PQ status - * codes to `enum GNUNET_DB_QueryStatus`. - */ enum GNUNET_DB_QueryStatus GNUNET_PQ_eval_prepared_multi_select (struct GNUNET_PQ_Context *db, const char *statement_name, @@ -239,21 +195,6 @@ GNUNET_PQ_eval_prepared_multi_select (struct GNUNET_PQ_Context *db, } -/** - * Execute a named prepared @a statement that is a SELECT statement - * which must return a single result in @a connection using the given - * @a params. Stores the result (if any) in @a rs, which the caller - * must then clean up using #GNUNET_PQ_cleanup_result() if the return - * value was #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT. Returns the - * resulting session status. - * - * @param db database to execute the statement with - * @param statement_name name of the statement - * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) - * @param[in,out] rs result specification to use for storing the result of the query - * @return status code from the result, mapping PQ status - * codes to `enum GNUNET_DB_QueryStatus`. - */ enum GNUNET_DB_QueryStatus GNUNET_PQ_eval_prepared_singleton_select ( 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 @@ #include "pq.h" -/** - * Create a `struct GNUNET_PQ_ExecuteStatement` where errors are fatal. - * - * @param sql actual SQL statement - * @return initialized struct - */ struct GNUNET_PQ_ExecuteStatement GNUNET_PQ_make_execute (const char *sql) { @@ -44,13 +38,6 @@ GNUNET_PQ_make_execute (const char *sql) } -/** - * Create a `struct GNUNET_PQ_ExecuteStatement` where errors should - * be tolerated. - * - * @param sql actual SQL statement - * @return initialized struct - */ struct GNUNET_PQ_ExecuteStatement GNUNET_PQ_make_try_execute (const char *sql) { -- cgit v1.2.3 From cfa61f12efe97933fb1e5ddda29873698f154f95 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Feb 2023 20:59:46 +0100 Subject: PG: do not return NOTIFY prefix in GNUNET_PG_get_event_notify_channel, commands may notify or listen or unlisten with the result --- src/pq/pq_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) char *end; end = stpcpy (sql, - "NOTIFY X"); + "X"); end = es_to_channel (es, end); GNUNET_assert (NULL != end); -- cgit v1.2.3