diff options
Diffstat (limited to 'src/pq/pq_exec.c')
-rw-r--r-- | src/pq/pq_exec.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/pq/pq_exec.c b/src/pq/pq_exec.c index 00527151a..fd4feae53 100644 --- a/src/pq/pq_exec.c +++ b/src/pq/pq_exec.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2017 GNUnet e.V. | 3 | Copyright (C) 2017, 2019 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -23,8 +23,7 @@ | |||
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | */ | 24 | */ |
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "gnunet_util_lib.h" | 26 | #include "pq.h" |
27 | #include "gnunet_pq_lib.h" | ||
28 | 27 | ||
29 | 28 | ||
30 | /** | 29 | /** |
@@ -67,14 +66,14 @@ GNUNET_PQ_make_try_execute (const char *sql) | |||
67 | /** | 66 | /** |
68 | * Request execution of an array of statements @a es from Postgres. | 67 | * Request execution of an array of statements @a es from Postgres. |
69 | * | 68 | * |
70 | * @param connection connection to execute the statements over | 69 | * @param db database to execute the statements with |
71 | * @param es #GNUNET_PQ_PREPARED_STATEMENT_END-terminated array of prepared | 70 | * @param es #GNUNET_PQ_PREPARED_STATEMENT_END-terminated array of prepared |
72 | * statements. | 71 | * statements. |
73 | * @return #GNUNET_OK on success (modulo statements where errors can be ignored) | 72 | * @return #GNUNET_OK on success (modulo statements where errors can be ignored) |
74 | * #GNUNET_SYSERR on error | 73 | * #GNUNET_SYSERR on error |
75 | */ | 74 | */ |
76 | int | 75 | int |
77 | GNUNET_PQ_exec_statements (PGconn *connection, | 76 | GNUNET_PQ_exec_statements (struct GNUNET_PQ_Context *db, |
78 | const struct GNUNET_PQ_ExecuteStatement *es) | 77 | const struct GNUNET_PQ_ExecuteStatement *es) |
79 | { | 78 | { |
80 | for (unsigned int i = 0; NULL != es[i].sql; i++) | 79 | for (unsigned int i = 0; NULL != es[i].sql; i++) |
@@ -84,8 +83,8 @@ GNUNET_PQ_exec_statements (PGconn *connection, | |||
84 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 83 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
85 | "Running statement `%s' on %p\n", | 84 | "Running statement `%s' on %p\n", |
86 | es[i].sql, | 85 | es[i].sql, |
87 | connection); | 86 | db); |
88 | result = PQexec (connection, | 87 | result = PQexec (db->conn, |
89 | es[i].sql); | 88 | es[i].sql); |
90 | if ((GNUNET_NO == es[i].ignore_errors) && | 89 | if ((GNUNET_NO == es[i].ignore_errors) && |
91 | (PGRES_COMMAND_OK != PQresultStatus (result))) | 90 | (PGRES_COMMAND_OK != PQresultStatus (result))) |
@@ -100,7 +99,7 @@ GNUNET_PQ_exec_statements (PGconn *connection, | |||
100 | PG_DIAG_MESSAGE_DETAIL), | 99 | PG_DIAG_MESSAGE_DETAIL), |
101 | PQresultErrorMessage (result), | 100 | PQresultErrorMessage (result), |
102 | PQresStatus (PQresultStatus (result)), | 101 | PQresStatus (PQresultStatus (result)), |
103 | PQerrorMessage (connection)); | 102 | PQerrorMessage (db->conn)); |
104 | PQclear (result); | 103 | PQclear (result); |
105 | return GNUNET_SYSERR; | 104 | return GNUNET_SYSERR; |
106 | } | 105 | } |