diff options
author | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
commit | d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch) | |
tree | 9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/pq/pq_prepare.c | |
parent | a0fce305c565c0937d917a92712f15e9c5736260 (diff) | |
download | gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip |
uncrustify as demanded.
Diffstat (limited to 'src/pq/pq_prepare.c')
-rw-r--r-- | src/pq/pq_prepare.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/pq/pq_prepare.c b/src/pq/pq_prepare.c index 9a8e4e76f..9899b65bb 100644 --- a/src/pq/pq_prepare.c +++ b/src/pq/pq_prepare.c | |||
@@ -1,22 +1,22 @@ | |||
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 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 |
7 | by the Free Software Foundation, either version 3 of the License, | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | or (at your option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file pq/pq_prepare.c | 21 | * @file pq/pq_prepare.c |
22 | * @brief functions to connect to libpq (PostGres) | 22 | * @brief functions to connect to libpq (PostGres) |
@@ -36,9 +36,9 @@ | |||
36 | * @return initialized struct | 36 | * @return initialized struct |
37 | */ | 37 | */ |
38 | struct GNUNET_PQ_PreparedStatement | 38 | struct GNUNET_PQ_PreparedStatement |
39 | GNUNET_PQ_make_prepare (const char *name, | 39 | GNUNET_PQ_make_prepare(const char *name, |
40 | const char *sql, | 40 | const char *sql, |
41 | unsigned int num_args) | 41 | unsigned int num_args) |
42 | { | 42 | { |
43 | struct GNUNET_PQ_PreparedStatement ps = { | 43 | struct GNUNET_PQ_PreparedStatement ps = { |
44 | .name = name, | 44 | .name = name, |
@@ -60,36 +60,36 @@ GNUNET_PQ_make_prepare (const char *name, | |||
60 | * #GNUNET_SYSERR on error | 60 | * #GNUNET_SYSERR on error |
61 | */ | 61 | */ |
62 | int | 62 | int |
63 | GNUNET_PQ_prepare_statements (PGconn *connection, | 63 | GNUNET_PQ_prepare_statements(PGconn *connection, |
64 | const struct GNUNET_PQ_PreparedStatement *ps) | 64 | const struct GNUNET_PQ_PreparedStatement *ps) |
65 | { | 65 | { |
66 | for (unsigned int i=0;NULL != ps[i].name;i++) | 66 | for (unsigned int i = 0; NULL != ps[i].name; i++) |
67 | { | ||
68 | PGresult *ret; | ||
69 | |||
70 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | ||
71 | "pq", | ||
72 | "Preparing SQL statement `%s' as `%s'\n", | ||
73 | ps[i].sql, | ||
74 | ps[i].name); | ||
75 | ret = PQprepare (connection, | ||
76 | ps[i].name, | ||
77 | ps[i].sql, | ||
78 | ps[i].num_arguments, | ||
79 | NULL); | ||
80 | if (PGRES_COMMAND_OK != PQresultStatus (ret)) | ||
81 | { | 67 | { |
82 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 68 | PGresult *ret; |
83 | "pq", | 69 | |
84 | _("PQprepare (`%s' as `%s') failed with error: %s\n"), | 70 | GNUNET_log_from(GNUNET_ERROR_TYPE_DEBUG, |
85 | ps[i].sql, | 71 | "pq", |
86 | ps[i].name, | 72 | "Preparing SQL statement `%s' as `%s'\n", |
87 | PQerrorMessage (connection)); | 73 | ps[i].sql, |
88 | PQclear (ret); | 74 | ps[i].name); |
89 | return GNUNET_SYSERR; | 75 | ret = PQprepare(connection, |
76 | ps[i].name, | ||
77 | ps[i].sql, | ||
78 | ps[i].num_arguments, | ||
79 | NULL); | ||
80 | if (PGRES_COMMAND_OK != PQresultStatus(ret)) | ||
81 | { | ||
82 | GNUNET_log_from(GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
83 | "pq", | ||
84 | _("PQprepare (`%s' as `%s') failed with error: %s\n"), | ||
85 | ps[i].sql, | ||
86 | ps[i].name, | ||
87 | PQerrorMessage(connection)); | ||
88 | PQclear(ret); | ||
89 | return GNUNET_SYSERR; | ||
90 | } | ||
91 | PQclear(ret); | ||
90 | } | 92 | } |
91 | PQclear (ret); | ||
92 | } | ||
93 | return GNUNET_OK; | 93 | return GNUNET_OK; |
94 | } | 94 | } |
95 | 95 | ||