diff options
Diffstat (limited to 'src/my/my.c')
-rw-r--r-- | src/my/my.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/my/my.c b/src/my/my.c index 1ab4a64db..7f01d7f63 100644 --- a/src/my/my.c +++ b/src/my/my.c | |||
@@ -20,6 +20,7 @@ | |||
20 | /** | 20 | /** |
21 | * @file my/my.c | 21 | * @file my/my.c |
22 | * @brief library to help with access to a MySQL database | 22 | * @brief library to help with access to a MySQL database |
23 | * @author Christophe Genevey | ||
23 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
24 | */ | 25 | */ |
25 | #include "platform.h" | 26 | #include "platform.h" |
@@ -34,10 +35,11 @@ | |||
34 | * @param mc mysql context | 35 | * @param mc mysql context |
35 | * @param sh handle to SELECT statment | 36 | * @param sh handle to SELECT statment |
36 | * @param params parameters to the statement | 37 | * @param params parameters to the statement |
37 | * @return mysql result | 38 | * @return |
39 | #GNUNET_YES if we can prepare all statement | ||
40 | #GNUNET_SYSERR if we can't prepare all statement | ||
38 | */ | 41 | */ |
39 | 42 | ||
40 | /***** FIXE THIS FUNCTION *****/ | ||
41 | int | 43 | int |
42 | GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc, | 44 | GNUNET_MY_exec_prepared (struct GNUNET_MYSQL_Context *mc, |
43 | struct GNUNET_MYSQL_StatementHandle *sh, | 45 | struct GNUNET_MYSQL_StatementHandle *sh, |
@@ -113,27 +115,38 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, | |||
113 | struct GNUNET_MY_ResultSpec *rs, | 115 | struct GNUNET_MY_ResultSpec *rs, |
114 | int row) | 116 | int row) |
115 | { | 117 | { |
116 | MYSQL_BIND * result; | 118 | MYSQL_BIND *result; |
117 | unsigned int i; | 119 | unsigned int i; |
118 | int had_null = GNUNET_NO; | 120 | int had_null = GNUNET_NO; |
119 | int ret; | 121 | int ret; |
122 | |||
120 | MYSQL_STMT *stmt; | 123 | MYSQL_STMT *stmt; |
121 | 124 | ||
122 | stmt = GNUNET_MYSQL_statement_get_stmt (NULL /* FIXME */, sh); | 125 | stmt = GNUNET_MYSQL_statement_get_stmt (NULL /* FIXME */, sh); |
123 | // result = mysql_get_result (stmt); | 126 | // result = mysql_get_result (stmt); |
124 | result = NULL; | 127 | result = NULL; |
128 | |||
129 | if (mysql_stmt_bind_result(stmt, result)) | ||
130 | { | ||
131 | |||
132 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "mysql", | ||
133 | _("`%s' failed at %s:%d with error: %s\n"), | ||
134 | "mysql_stmt_bind_result", __FILE__, __LINE__, | ||
135 | mysql_stmt_error (stmt)); | ||
136 | return GNUNET_SYSERR; | ||
137 | } | ||
138 | |||
125 | for (i = 0 ; NULL != rs[i].conv ; i++) | 139 | for (i = 0 ; NULL != rs[i].conv ; i++) |
126 | { | 140 | { |
127 | struct GNUNET_MY_ResultSpec *spec; | 141 | struct GNUNET_MY_ResultSpec *spec; |
128 | 142 | ||
129 | spec = &rs[i]; | 143 | spec = &rs[i]; |
130 | ret = spec->conv (spec->conv_cls, | 144 | ret = spec->conv (spec->conv_cls, |
131 | qp, | 145 | spec, |
132 | result); | 146 | result); |
133 | 147 | ||
134 | if (GNUNET_SYSERR == ret) | 148 | if (GNUNET_SYSERR == ret) |
135 | { | 149 | { |
136 | //GNUNET_MY_cleanup_result(rs); | ||
137 | return GNUNET_SYSERR; | 150 | return GNUNET_SYSERR; |
138 | } | 151 | } |
139 | 152 | ||