diff options
Diffstat (limited to 'src/pq/pq_exec.c')
-rw-r--r-- | src/pq/pq_exec.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/pq/pq_exec.c b/src/pq/pq_exec.c index 6c8002aff..00527151a 100644 --- a/src/pq/pq_exec.c +++ b/src/pq/pq_exec.c | |||
@@ -34,7 +34,7 @@ | |||
34 | * @return initialized struct | 34 | * @return initialized struct |
35 | */ | 35 | */ |
36 | struct GNUNET_PQ_ExecuteStatement | 36 | struct GNUNET_PQ_ExecuteStatement |
37 | GNUNET_PQ_make_execute(const char *sql) | 37 | GNUNET_PQ_make_execute (const char *sql) |
38 | { | 38 | { |
39 | struct GNUNET_PQ_ExecuteStatement es = { | 39 | struct GNUNET_PQ_ExecuteStatement es = { |
40 | .sql = sql, | 40 | .sql = sql, |
@@ -53,7 +53,7 @@ GNUNET_PQ_make_execute(const char *sql) | |||
53 | * @return initialized struct | 53 | * @return initialized struct |
54 | */ | 54 | */ |
55 | struct GNUNET_PQ_ExecuteStatement | 55 | struct GNUNET_PQ_ExecuteStatement |
56 | GNUNET_PQ_make_try_execute(const char *sql) | 56 | GNUNET_PQ_make_try_execute (const char *sql) |
57 | { | 57 | { |
58 | struct GNUNET_PQ_ExecuteStatement es = { | 58 | struct GNUNET_PQ_ExecuteStatement es = { |
59 | .sql = sql, | 59 | .sql = sql, |
@@ -74,38 +74,38 @@ GNUNET_PQ_make_try_execute(const char *sql) | |||
74 | * #GNUNET_SYSERR on error | 74 | * #GNUNET_SYSERR on error |
75 | */ | 75 | */ |
76 | int | 76 | int |
77 | GNUNET_PQ_exec_statements(PGconn *connection, | 77 | GNUNET_PQ_exec_statements (PGconn *connection, |
78 | const struct GNUNET_PQ_ExecuteStatement *es) | 78 | const struct GNUNET_PQ_ExecuteStatement *es) |
79 | { | 79 | { |
80 | for (unsigned int i = 0; NULL != es[i].sql; i++) | 80 | for (unsigned int i = 0; NULL != es[i].sql; i++) |
81 | { | 81 | { |
82 | PGresult *result; | 82 | PGresult *result; |
83 | 83 | ||
84 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 84 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
85 | "Running statement `%s' on %p\n", | 85 | "Running statement `%s' on %p\n", |
86 | es[i].sql, | 86 | es[i].sql, |
87 | connection); | 87 | connection); |
88 | result = PQexec(connection, | 88 | result = PQexec (connection, |
89 | es[i].sql); | 89 | es[i].sql); |
90 | if ((GNUNET_NO == es[i].ignore_errors) && | 90 | if ((GNUNET_NO == es[i].ignore_errors) && |
91 | (PGRES_COMMAND_OK != PQresultStatus(result))) | 91 | (PGRES_COMMAND_OK != PQresultStatus (result))) |
92 | { | 92 | { |
93 | GNUNET_log_from(GNUNET_ERROR_TYPE_ERROR, | 93 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, |
94 | "pq", | 94 | "pq", |
95 | "Failed to execute `%s': %s/%s/%s/%s/%s", | 95 | "Failed to execute `%s': %s/%s/%s/%s/%s", |
96 | es[i].sql, | 96 | es[i].sql, |
97 | PQresultErrorField(result, | 97 | PQresultErrorField (result, |
98 | PG_DIAG_MESSAGE_PRIMARY), | 98 | PG_DIAG_MESSAGE_PRIMARY), |
99 | PQresultErrorField(result, | 99 | PQresultErrorField (result, |
100 | PG_DIAG_MESSAGE_DETAIL), | 100 | PG_DIAG_MESSAGE_DETAIL), |
101 | PQresultErrorMessage(result), | 101 | PQresultErrorMessage (result), |
102 | PQresStatus(PQresultStatus(result)), | 102 | PQresStatus (PQresultStatus (result)), |
103 | PQerrorMessage(connection)); | 103 | PQerrorMessage (connection)); |
104 | PQclear(result); | 104 | PQclear (result); |
105 | return GNUNET_SYSERR; | 105 | return GNUNET_SYSERR; |
106 | } | ||
107 | PQclear(result); | ||
108 | } | 106 | } |
107 | PQclear (result); | ||
108 | } | ||
109 | return GNUNET_OK; | 109 | return GNUNET_OK; |
110 | } | 110 | } |
111 | 111 | ||