aboutsummaryrefslogtreecommitdiff
path: root/src/my/my_query_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/my/my_query_helper.c')
-rw-r--r--src/my/my_query_helper.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/my/my_query_helper.c b/src/my/my_query_helper.c
index 17ade5a92..b2a893a44 100644
--- a/src/my/my_query_helper.c
+++ b/src/my/my_query_helper.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2016 GNUnet e.V. 3 Copyright (C) 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU 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, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file my/my_query_helper.c 19 * @file my/my_query_helper.c
@@ -39,6 +37,7 @@ static void
39my_clean_query (void *cls, 37my_clean_query (void *cls,
40 MYSQL_BIND *qbind) 38 MYSQL_BIND *qbind)
41{ 39{
40 (void) cls;
42 GNUNET_free (qbind[0].buffer); 41 GNUNET_free (qbind[0].buffer);
43} 42}
44 43
@@ -56,6 +55,7 @@ my_conv_fixed_size (void *cls,
56 const struct GNUNET_MY_QueryParam *qp, 55 const struct GNUNET_MY_QueryParam *qp,
57 MYSQL_BIND *qbind) 56 MYSQL_BIND *qbind)
58{ 57{
58 (void) cls;
59 GNUNET_assert (1 == qp->num_params); 59 GNUNET_assert (1 == qp->num_params);
60 qbind->buffer = (void *) qp->data; 60 qbind->buffer = (void *) qp->data;
61 qbind->buffer_length = qp->data_len; 61 qbind->buffer_length = qp->data_len;
@@ -101,12 +101,11 @@ my_conv_string (void *cls,
101 const struct GNUNET_MY_QueryParam *qp, 101 const struct GNUNET_MY_QueryParam *qp,
102 MYSQL_BIND *qbind) 102 MYSQL_BIND *qbind)
103{ 103{
104 (void) cls;
104 GNUNET_assert (1 == qp->num_params); 105 GNUNET_assert (1 == qp->num_params);
105
106 qbind->buffer = (void *) qp->data; 106 qbind->buffer = (void *) qp->data;
107 qbind->buffer_length = qp->data_len; 107 qbind->buffer_length = qp->data_len;
108 qbind->buffer_type = MYSQL_TYPE_STRING; 108 qbind->buffer_type = MYSQL_TYPE_STRING;
109
110 return 1; 109 return 1;
111} 110}
112 111
@@ -144,10 +143,12 @@ my_conv_uint16 (void *cls,
144 const struct GNUNET_MY_QueryParam *qp, 143 const struct GNUNET_MY_QueryParam *qp,
145 MYSQL_BIND *qbind) 144 MYSQL_BIND *qbind)
146{ 145{
146 (void) cls;
147 GNUNET_assert (1 == qp->num_params); 147 GNUNET_assert (1 == qp->num_params);
148 qbind->buffer = (void *) qp->data; 148 qbind->buffer = (void *) qp->data;
149 qbind->buffer_length = sizeof (uint16_t); 149 qbind->buffer_length = sizeof (uint16_t);
150 qbind->buffer_type = MYSQL_TYPE_SHORT; 150 qbind->buffer_type = MYSQL_TYPE_SHORT;
151 qbind->is_unsigned = 1;
151 return 1; 152 return 1;
152} 153}
153 154
@@ -186,11 +187,12 @@ my_conv_uint32 (void *cls,
186 const struct GNUNET_MY_QueryParam *qp, 187 const struct GNUNET_MY_QueryParam *qp,
187 MYSQL_BIND *qbind) 188 MYSQL_BIND *qbind)
188{ 189{
190 (void) cls;
189 GNUNET_assert (1 == qp->num_params); 191 GNUNET_assert (1 == qp->num_params);
190 qbind->buffer = (void *) qp->data; 192 qbind->buffer = (void *) qp->data;
191 qbind->buffer_length = sizeof(uint32_t); 193 qbind->buffer_length = sizeof(uint32_t);
192 qbind->buffer_type = MYSQL_TYPE_LONG; 194 qbind->buffer_type = MYSQL_TYPE_LONG;
193 195 qbind->is_unsigned = 1;
194 return 1; 196 return 1;
195} 197}
196 198
@@ -229,10 +231,12 @@ my_conv_uint64 (void *cls,
229 const struct GNUNET_MY_QueryParam *qp, 231 const struct GNUNET_MY_QueryParam *qp,
230 MYSQL_BIND * qbind) 232 MYSQL_BIND * qbind)
231{ 233{
234 (void) cls;
232 GNUNET_assert (1 == qp->num_params); 235 GNUNET_assert (1 == qp->num_params);
233 qbind->buffer = (void *) qp->data; 236 qbind->buffer = (void *) qp->data;
234 qbind->buffer_length = sizeof (uint64_t); 237 qbind->buffer_length = sizeof (uint64_t);
235 qbind->buffer_type = MYSQL_TYPE_LONGLONG; 238 qbind->buffer_type = MYSQL_TYPE_LONGLONG;
239 qbind->is_unsigned = 1;
236 return 1; 240 return 1;
237} 241}
238 242
@@ -275,14 +279,13 @@ my_conv_rsa_public_key (void *cls,
275 char *buf; 279 char *buf;
276 size_t buf_size; 280 size_t buf_size;
277 281
282 (void) cls;
278 GNUNET_assert(1 == qp->num_params); 283 GNUNET_assert(1 == qp->num_params);
279 284 buf_size = GNUNET_CRYPTO_rsa_public_key_encode (rsa,
280 buf_size = GNUNET_CRYPTO_rsa_public_key_encode (rsa, &buf); 285 &buf);
281
282 qbind->buffer = (void *) buf; 286 qbind->buffer = (void *) buf;
283 qbind->buffer_length = buf_size; 287 qbind->buffer_length = buf_size;
284 qbind->buffer_type = MYSQL_TYPE_BLOB; 288 qbind->buffer_type = MYSQL_TYPE_BLOB;
285
286 return 1; 289 return 1;
287} 290}
288 291
@@ -327,14 +330,13 @@ my_conv_rsa_signature (void *cls,
327 char *buf; 330 char *buf;
328 size_t buf_size; 331 size_t buf_size;
329 332
333 (void) cls;
330 GNUNET_assert(1 == qp->num_params); 334 GNUNET_assert(1 == qp->num_params);
331
332 buf_size = GNUNET_CRYPTO_rsa_signature_encode (sig, 335 buf_size = GNUNET_CRYPTO_rsa_signature_encode (sig,
333 &buf); 336 &buf);
334 qbind->buffer = (void *) buf; 337 qbind->buffer = (void *) buf;
335 qbind->buffer_length = buf_size; 338 qbind->buffer_length = buf_size;
336 qbind->buffer_type = MYSQL_TYPE_BLOB; 339 qbind->buffer_type = MYSQL_TYPE_BLOB;
337
338 return 1; 340 return 1;
339} 341}
340 342