summaryrefslogtreecommitdiff
path: root/src/sq/sq_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sq/sq_exec.c')
-rw-r--r--src/sq/sq_exec.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/sq/sq_exec.c b/src/sq/sq_exec.c
index ebc159421..1dfa535d9 100644
--- a/src/sq/sq_exec.c
+++ b/src/sq/sq_exec.c
@@ -33,7 +33,7 @@
33 * @return initialized struct 33 * @return initialized struct
34 */ 34 */
35struct GNUNET_SQ_ExecuteStatement 35struct GNUNET_SQ_ExecuteStatement
36GNUNET_SQ_make_execute(const char *sql) 36GNUNET_SQ_make_execute (const char *sql)
37{ 37{
38 struct GNUNET_SQ_ExecuteStatement es = { 38 struct GNUNET_SQ_ExecuteStatement es = {
39 .sql = sql, 39 .sql = sql,
@@ -53,7 +53,7 @@ GNUNET_SQ_make_execute(const char *sql)
53 * @return initialized struct 53 * @return initialized struct
54 */ 54 */
55struct GNUNET_SQ_ExecuteStatement 55struct GNUNET_SQ_ExecuteStatement
56GNUNET_SQ_make_try_execute(const char *sql) 56GNUNET_SQ_make_try_execute (const char *sql)
57{ 57{
58 struct GNUNET_SQ_ExecuteStatement es = { 58 struct GNUNET_SQ_ExecuteStatement es = {
59 .sql = sql, 59 .sql = sql,
@@ -74,39 +74,39 @@ GNUNET_SQ_make_try_execute(const char *sql)
74 * #GNUNET_SYSERR on error 74 * #GNUNET_SYSERR on error
75 */ 75 */
76int 76int
77GNUNET_SQ_exec_statements(sqlite3 *dbh, 77GNUNET_SQ_exec_statements (sqlite3 *dbh,
78 const struct GNUNET_SQ_ExecuteStatement *es) 78 const struct GNUNET_SQ_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 char *emsg = NULL; 82 char *emsg = NULL;
83 83
84 if (SQLITE_OK != 84 if (SQLITE_OK !=
85 sqlite3_exec(dbh, 85 sqlite3_exec (dbh,
86 es[i].sql, 86 es[i].sql,
87 NULL, 87 NULL,
88 NULL, 88 NULL,
89 &emsg)) 89 &emsg))
90 { 90 {
91 if (es[i].ignore_errors) 91 if (es[i].ignore_errors)
92 { 92 {
93 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 93 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
94 "Failed to run SQL `%s': %s\n", 94 "Failed to run SQL `%s': %s\n",
95 es[i].sql, 95 es[i].sql,
96 emsg); 96 emsg);
97 } 97 }
98 else 98 else
99 { 99 {
100 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 100 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
101 "Failed to run SQL `%s': %s\n", 101 "Failed to run SQL `%s': %s\n",
102 es[i].sql, 102 es[i].sql,
103 emsg); 103 emsg);
104 sqlite3_free(emsg); 104 sqlite3_free (emsg);
105 return GNUNET_SYSERR; 105 return GNUNET_SYSERR;
106 } 106 }
107 sqlite3_free(emsg); 107 sqlite3_free (emsg);
108 }
109 } 108 }
109 }
110 return GNUNET_OK; 110 return GNUNET_OK;
111} 111}
112 112