diff options
author | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-06-13 11:24:06 +0000 |
---|---|---|
committer | Christophe Genevey Metat <genevey.christophe@gmail.com> | 2016-06-13 11:24:06 +0000 |
commit | e290fbfbeae0a3bccf2c2dc68f5d37bc1f3c4f81 (patch) | |
tree | 028a079fd3665654ce95dc60d3c75f126b15d0be /src/my/my_result_helper.c | |
parent | fcbbb6b6eb594be079894681d23e318918f6bf26 (diff) | |
download | gnunet-e290fbfbeae0a3bccf2c2dc68f5d37bc1f3c4f81.tar.gz gnunet-e290fbfbeae0a3bccf2c2dc68f5d37bc1f3c4f81.zip |
lcov test function
Diffstat (limited to 'src/my/my_result_helper.c')
-rw-r--r-- | src/my/my_result_helper.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/my/my_result_helper.c b/src/my/my_result_helper.c index 963e3f618..c0a1dff4d 100644 --- a/src/my/my_result_helper.c +++ b/src/my/my_result_helper.c | |||
@@ -501,10 +501,11 @@ pre_extract_string (void * cls, | |||
501 | unsigned int column, | 501 | unsigned int column, |
502 | MYSQL_BIND *results) | 502 | MYSQL_BIND *results) |
503 | { | 503 | { |
504 | results[0].buffer = (char *)rs->dst; | 504 | results[0].buffer = NULL; |
505 | results[0].buffer_length = rs->dst_size; | 505 | results[0].buffer_length = 0; |
506 | results[0].length = &rs->mysql_bind_output_length; | 506 | results[0].length = &rs->mysql_bind_output_length; |
507 | 507 | results[0].buffer_type = MYSQL_TYPE_BLOB; | |
508 | |||
508 | return GNUNET_OK; | 509 | return GNUNET_OK; |
509 | } | 510 | } |
510 | 511 | ||
@@ -528,8 +529,30 @@ post_extract_string (void * cls, | |||
528 | unsigned int column, | 529 | unsigned int column, |
529 | MYSQL_BIND *results) | 530 | MYSQL_BIND *results) |
530 | { | 531 | { |
531 | if (rs->dst_size != rs->mysql_bind_output_length) | 532 | size_t size; |
533 | |||
534 | size = (size_t) rs->mysql_bind_output_length; | ||
535 | char buf[size]; | ||
536 | |||
537 | if (rs->mysql_bind_output_length != size) | ||
538 | return GNUNET_SYSERR; | ||
539 | |||
540 | results[0].buffer = buf; | ||
541 | results[0].buffer_length = size; | ||
542 | results[0].buffer_type = MYSQL_TYPE_BLOB; | ||
543 | |||
544 | if (0 != | ||
545 | mysql_stmt_fetch_column (stmt, | ||
546 | results, | ||
547 | column, | ||
548 | 0)) | ||
549 | { | ||
550 | GNUNET_free (buf); | ||
532 | return GNUNET_SYSERR; | 551 | return GNUNET_SYSERR; |
552 | } | ||
553 | |||
554 | rs->dst = buf; | ||
555 | |||
533 | return GNUNET_OK; | 556 | return GNUNET_OK; |
534 | } | 557 | } |
535 | 558 | ||