diff options
author | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-06-22 15:26:52 +0000 |
---|---|---|
committer | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-06-22 15:26:52 +0000 |
commit | 3646d330284a17c0e7d9cf16a61b91d64b6adaef (patch) | |
tree | 2910a425889fb8b04650a30a45a57ef93ca10119 /src/datastore | |
parent | eed68e90e8564b578fd92ef130d305465cecf936 (diff) | |
download | gnunet-3646d330284a17c0e7d9cf16a61b91d64b6adaef.tar.gz gnunet-3646d330284a17c0e7d9cf16a61b91d64b6adaef.zip |
plugin datastore mysql
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/plugin_datastore_mysql.c | 59 | ||||
-rw-r--r-- | src/datastore/test_plugin_datastore_data_mysql.conf | 2 |
2 files changed, 56 insertions, 5 deletions
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index 3bfdf004f..9672937ed 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c | |||
@@ -123,7 +123,6 @@ | |||
123 | #include "gnunet_mysql_lib.h" | 123 | #include "gnunet_mysql_lib.h" |
124 | #include "gnunet_my_lib.h" | 124 | #include "gnunet_my_lib.h" |
125 | 125 | ||
126 | |||
127 | #define MAX_DATUM_SIZE 65536 | 126 | #define MAX_DATUM_SIZE 65536 |
128 | 127 | ||
129 | 128 | ||
@@ -496,6 +495,7 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt | |||
496 | unsigned int anonymity; | 495 | unsigned int anonymity; |
497 | // unsigned long long exp; | 496 | // unsigned long long exp; |
498 | uint64_t exp; | 497 | uint64_t exp; |
498 | //char *type = NULL; | ||
499 | //size_t hashSize; | 499 | //size_t hashSize; |
500 | // unsigned long size; | 500 | // unsigned long size; |
501 | size_t size; | 501 | size_t size; |
@@ -532,10 +532,63 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt | |||
532 | rbind[6].buffer = &uid; | 532 | rbind[6].buffer = &uid; |
533 | rbind[6].is_unsigned = 1; | 533 | rbind[6].is_unsigned = 1; |
534 | */ | 534 | */ |
535 | // ret = GNUNET_MYSQL_statement_run_prepared_select_va (plugin->mc, stmt, 7, rbind, NULL, NULL, ap); | ||
536 | va_start (ap, proc_cls); | ||
537 | |||
538 | struct GNUNET_MY_QueryParam *params_select = NULL; | ||
539 | struct GNUNET_MY_QueryParam end = GNUNET_MY_query_param_end; | ||
540 | |||
541 | unsigned int *param_long = NULL; | ||
542 | int param_is_unsigned; | ||
543 | unsigned long param_length; | ||
544 | unsigned long *length = NULL; | ||
545 | |||
546 | unsigned long long *param_longlong = NULL; | ||
547 | void *param_blob = NULL; | ||
548 | |||
549 | // enum enum_field_type ft; | ||
550 | int ft; | ||
551 | int i = 0; | ||
552 | |||
553 | ft = 0; | ||
554 | |||
555 | while (-1 != (ft = va_arg(ap, int))) | ||
556 | { | ||
557 | switch (ft) | ||
558 | { | ||
559 | case MYSQL_TYPE_LONG: | ||
560 | param_long = va_arg (ap, unsigned int*); | ||
561 | param_is_unsigned = va_arg (ap, int); | ||
562 | params_select[i] = GNUNET_MY_query_param_uint32 (param_long); | ||
563 | break; | ||
564 | |||
565 | case MYSQL_TYPE_LONGLONG: | ||
566 | param_longlong = va_arg (ap, unsigned long long *); | ||
567 | param_is_unsigned = va_arg (ap, int); | ||
568 | params_select[i] = GNUNET_MY_query_param_uint64 (param_longlong); | ||
569 | break; | ||
570 | |||
571 | case MYSQL_TYPE_BLOB: | ||
572 | param_blob = va_arg (ap, void *); | ||
573 | param_length = va_arg (ap, unsigned long); | ||
574 | length = va_arg (ap, unsigned long *); | ||
575 | params_select[i] = GNUNET_MY_query_param_fixed_size (param_blob, param_length); | ||
576 | break; | ||
577 | |||
578 | default: | ||
579 | GNUNET_break(0); | ||
580 | } | ||
581 | i++; | ||
582 | } | ||
583 | |||
584 | params_select[i] = end; | ||
585 | |||
586 | /* | ||
535 | struct GNUNET_MY_QueryParam params_select[] ={ | 587 | struct GNUNET_MY_QueryParam params_select[] ={ |
588 | |||
536 | GNUNET_MY_query_param_end | 589 | GNUNET_MY_query_param_end |
537 | }; | 590 | }; |
538 | 591 | */ | |
539 | struct GNUNET_MY_ResultSpec results_select[] = { | 592 | struct GNUNET_MY_ResultSpec results_select[] = { |
540 | GNUNET_MY_result_spec_uint32 (&type), | 593 | GNUNET_MY_result_spec_uint32 (&type), |
541 | GNUNET_MY_result_spec_uint32 (&priority), | 594 | GNUNET_MY_result_spec_uint32 (&priority), |
@@ -547,8 +600,6 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt | |||
547 | GNUNET_MY_query_param_end | 600 | GNUNET_MY_query_param_end |
548 | }; | 601 | }; |
549 | 602 | ||
550 | va_start (ap, proc_cls); | ||
551 | // ret = GNUNET_MYSQL_statement_run_prepared_select_va (plugin->mc, stmt, 7, rbind, NULL, NULL, ap); | ||
552 | ret = GNUNET_MY_exec_prepared (plugin->mc, stmt, params_select); | 603 | ret = GNUNET_MY_exec_prepared (plugin->mc, stmt, params_select); |
553 | va_end (ap); | 604 | va_end (ap); |
554 | if (ret <= 0) | 605 | if (ret <= 0) |
diff --git a/src/datastore/test_plugin_datastore_data_mysql.conf b/src/datastore/test_plugin_datastore_data_mysql.conf index ac7a3cde1..53a188997 100644 --- a/src/datastore/test_plugin_datastore_data_mysql.conf +++ b/src/datastore/test_plugin_datastore_data_mysql.conf | |||
@@ -6,5 +6,5 @@ GNUNET_TEST_HOME = /tmp/test-gnunet-datastore-plugin-mysql/ | |||
6 | DATABASE = mysql | 6 | DATABASE = mysql |
7 | 7 | ||
8 | [datastore-mysql] | 8 | [datastore-mysql] |
9 | DATABASE = gnunet | 9 | DATABASE = gnunetcheck |
10 | 10 | ||