diff options
Diffstat (limited to 'src/my')
-rw-r--r-- | src/my/my.c | 11 | ||||
-rw-r--r-- | src/my/my_result_helper.c | 11 | ||||
-rw-r--r-- | src/my/test_my.c | 10 |
3 files changed, 20 insertions, 12 deletions
diff --git a/src/my/my.c b/src/my/my.c index ef11fbe74..93b0a05b4 100644 --- a/src/my/my.c +++ b/src/my/my.c | |||
@@ -175,17 +175,10 @@ GNUNET_MY_extract_result (struct GNUNET_MYSQL_StatementHandle *sh, | |||
175 | } | 175 | } |
176 | 176 | ||
177 | ret = mysql_stmt_fetch (stmt); | 177 | ret = mysql_stmt_fetch (stmt); |
178 | 178 | ||
179 | if (MYSQL_DATA_TRUNCATED == ret) | ||
180 | { | ||
181 | fprintf(stderr, "Data truncated with error %d \n", ret); | ||
182 | fprintf(stderr, "nontruncated length of the parameter values : %d\n", rs[0].mysql_bind_output_length); | ||
183 | return GNUNET_SYSERR; | ||
184 | } | ||
185 | |||
186 | if (MYSQL_NO_DATA == ret) | 179 | if (MYSQL_NO_DATA == ret) |
187 | return GNUNET_NO; | 180 | return GNUNET_NO; |
188 | if (0 != ret) | 181 | if ((0 != ret ) & (MYSQL_DATA_TRUNCATED != ret)) |
189 | { | 182 | { |
190 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, | 183 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, |
191 | "my", | 184 | "my", |
diff --git a/src/my/my_result_helper.c b/src/my/my_result_helper.c index 97cc1f1bf..2d2c18cec 100644 --- a/src/my/my_result_helper.c +++ b/src/my/my_result_helper.c | |||
@@ -40,7 +40,7 @@ pre_extract_varsize_blob (void *cls, | |||
40 | results[0].buffer = NULL; | 40 | results[0].buffer = NULL; |
41 | results[0].buffer_length = 0; | 41 | results[0].buffer_length = 0; |
42 | results[0].length = &rs->mysql_bind_output_length; | 42 | results[0].length = &rs->mysql_bind_output_length; |
43 | results[0].buffer_type = MYSQL_TYPE_BLOB; | 43 | // results[0].buffer_type = MYSQL_TYPE_BLOB; |
44 | 44 | ||
45 | return GNUNET_OK; | 45 | return GNUNET_OK; |
46 | } | 46 | } |
@@ -69,11 +69,16 @@ post_extract_varsize_blob (void *cls, | |||
69 | size_t size; | 69 | size_t size; |
70 | 70 | ||
71 | size = (size_t) rs->mysql_bind_output_length; | 71 | size = (size_t) rs->mysql_bind_output_length; |
72 | |||
72 | if (rs->mysql_bind_output_length != size) | 73 | if (rs->mysql_bind_output_length != size) |
73 | return GNUNET_SYSERR; /* 'unsigned long' does not fit in size_t!? */ | 74 | return GNUNET_SYSERR; /* 'unsigned long' does not fit in size_t!? */ |
74 | buf = GNUNET_malloc (size); | 75 | buf = GNUNET_malloc (size); |
76 | |||
75 | results[0].buffer = buf; | 77 | results[0].buffer = buf; |
76 | results[0].buffer_length = size; | 78 | results[0].buffer_length = size; |
79 | results[0].buffer_type = MYSQL_TYPE_BLOB; | ||
80 | |||
81 | fprintf(stderr, "size : %d\n", size); | ||
77 | 82 | ||
78 | if (0 != | 83 | if (0 != |
79 | mysql_stmt_fetch_column (stmt, | 84 | mysql_stmt_fetch_column (stmt, |
@@ -84,8 +89,12 @@ post_extract_varsize_blob (void *cls, | |||
84 | GNUNET_free (buf); | 89 | GNUNET_free (buf); |
85 | return GNUNET_SYSERR; | 90 | return GNUNET_SYSERR; |
86 | } | 91 | } |
92 | |||
93 | printf("buf : %s\n", (char*)buf); | ||
94 | |||
87 | *(void **) rs->dst = buf; | 95 | *(void **) rs->dst = buf; |
88 | *rs->result_size = size; | 96 | *rs->result_size = size; |
97 | |||
89 | return GNUNET_OK; | 98 | return GNUNET_OK; |
90 | } | 99 | } |
91 | 100 | ||
diff --git a/src/my/test_my.c b/src/my/test_my.c index af15b6ab2..b8b5faf33 100644 --- a/src/my/test_my.c +++ b/src/my/test_my.c | |||
@@ -162,7 +162,7 @@ run_queries (struct GNUNET_MYSQL_Context *context) | |||
162 | " abs_time" | 162 | " abs_time" |
163 | ",forever" | 163 | ",forever" |
164 | ",hash" | 164 | ",hash" |
165 | //" vsize" | 165 | ",vsize" |
166 | ",u16" | 166 | ",u16" |
167 | ",u32" | 167 | ",u32" |
168 | ",u64" | 168 | ",u64" |
@@ -206,7 +206,7 @@ run_queries (struct GNUNET_MYSQL_Context *context) | |||
206 | GNUNET_MY_result_spec_absolute_time (&abs_time2), | 206 | GNUNET_MY_result_spec_absolute_time (&abs_time2), |
207 | GNUNET_MY_result_spec_absolute_time (&forever2), | 207 | GNUNET_MY_result_spec_absolute_time (&forever2), |
208 | GNUNET_MY_result_spec_auto_from_type (&hc2), | 208 | GNUNET_MY_result_spec_auto_from_type (&hc2), |
209 | //GNUNET_MY_result_spec_variable_size (&msg2, &msg2_len), | 209 | GNUNET_MY_result_spec_variable_size (&msg2, &msg2_len), |
210 | GNUNET_MY_result_spec_uint16 (&u162), | 210 | GNUNET_MY_result_spec_uint16 (&u162), |
211 | GNUNET_MY_result_spec_uint32 (&u322), | 211 | GNUNET_MY_result_spec_uint32 (&u322), |
212 | GNUNET_MY_result_spec_uint64 (&u642), | 212 | GNUNET_MY_result_spec_uint64 (&u642), |
@@ -224,6 +224,12 @@ run_queries (struct GNUNET_MYSQL_Context *context) | |||
224 | &hc2, | 224 | &hc2, |
225 | sizeof (struct GNUNET_HashCode))); | 225 | sizeof (struct GNUNET_HashCode))); |
226 | 226 | ||
227 | GNUNET_break (strlen (msg) == msg2_len); | ||
228 | GNUNET_break (0 == | ||
229 | strncmp (msg, | ||
230 | msg2, | ||
231 | msg2_len)); | ||
232 | fprintf(stderr, "msg2 : %d\n", strlen(msg2)); | ||
227 | GNUNET_break (16 == u162); | 233 | GNUNET_break (16 == u162); |
228 | GNUNET_break (32 == u322); | 234 | GNUNET_break (32 == u322); |
229 | GNUNET_break (64 == u642); | 235 | GNUNET_break (64 == u642); |