diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-13 13:25:05 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-13 13:25:05 +0000 |
commit | 35927ed463d637b46ec7f819578dbdf46b44d1f4 (patch) | |
tree | 39d22465902f9653c0c1bb348c9d17ee0019d67c /src/namestore/plugin_namestore_sqlite.c | |
parent | 700adc7f3dd9aa84f52517e091d27a271f3f7e07 (diff) | |
download | gnunet-35927ed463d637b46ec7f819578dbdf46b44d1f4.tar.gz gnunet-35927ed463d637b46ec7f819578dbdf46b44d1f4.zip |
-namestore service builds again
Diffstat (limited to 'src/namestore/plugin_namestore_sqlite.c')
-rw-r--r-- | src/namestore/plugin_namestore_sqlite.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 3559dc7ce..7e8ee12a6 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c | |||
@@ -493,8 +493,7 @@ namestore_sqlite_cache_block (void *cls, | |||
493 | * @param query hash of public key derived from the zone and the label | 493 | * @param query hash of public key derived from the zone and the label |
494 | * @param iter function to call with the result | 494 | * @param iter function to call with the result |
495 | * @param iter_cls closure for iter | 495 | * @param iter_cls closure for iter |
496 | * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error | 496 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error |
497 | * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' | ||
498 | */ | 497 | */ |
499 | static int | 498 | static int |
500 | namestore_sqlite_lookup_block (void *cls, | 499 | namestore_sqlite_lookup_block (void *cls, |
@@ -523,7 +522,6 @@ namestore_sqlite_lookup_block (void *cls, | |||
523 | ret = GNUNET_NO; | 522 | ret = GNUNET_NO; |
524 | if (SQLITE_ROW == (sret = sqlite3_step (plugin->lookup_block))) | 523 | if (SQLITE_ROW == (sret = sqlite3_step (plugin->lookup_block))) |
525 | { | 524 | { |
526 | ret = GNUNET_YES; | ||
527 | block = sqlite3_column_blob (plugin->lookup_block, 0); | 525 | block = sqlite3_column_blob (plugin->lookup_block, 0); |
528 | block_size = sqlite3_column_bytes (plugin->lookup_block, 0); | 526 | block_size = sqlite3_column_bytes (plugin->lookup_block, 0); |
529 | if ( (block_size < sizeof (struct GNUNET_NAMESTORE_Block)) || | 527 | if ( (block_size < sizeof (struct GNUNET_NAMESTORE_Block)) || |
@@ -537,13 +535,16 @@ namestore_sqlite_lookup_block (void *cls, | |||
537 | else | 535 | else |
538 | { | 536 | { |
539 | iter (iter_cls, block); | 537 | iter (iter_cls, block); |
538 | ret = GNUNET_YES; | ||
540 | } | 539 | } |
541 | } | 540 | } |
542 | else | 541 | else |
543 | { | 542 | { |
544 | if (SQLITE_DONE != sret) | 543 | if (SQLITE_DONE != sret) |
545 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); | 544 | { |
546 | iter (iter_cls, NULL); | 545 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); |
546 | ret = GNUNET_SYSERR; | ||
547 | } | ||
547 | } | 548 | } |
548 | if (SQLITE_OK != sqlite3_reset (plugin->lookup_block)) | 549 | if (SQLITE_OK != sqlite3_reset (plugin->lookup_block)) |
549 | LOG_SQLITE (plugin, | 550 | LOG_SQLITE (plugin, |
@@ -562,7 +563,7 @@ namestore_sqlite_lookup_block (void *cls, | |||
562 | * @param label name that is being mapped (at most 255 characters long) | 563 | * @param label name that is being mapped (at most 255 characters long) |
563 | * @param rd_count number of entries in 'rd' array | 564 | * @param rd_count number of entries in 'rd' array |
564 | * @param rd array of records with data to store | 565 | * @param rd array of records with data to store |
565 | * @return GNUNET_OK on success, else GNUNET_SYSERR | 566 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
566 | */ | 567 | */ |
567 | static int | 568 | static int |
568 | namestore_sqlite_store_records (void *cls, | 569 | namestore_sqlite_store_records (void *cls, |
@@ -677,8 +678,8 @@ namestore_sqlite_store_records (void *cls, | |||
677 | * @param stmt to run (and then clean up) | 678 | * @param stmt to run (and then clean up) |
678 | * @param zone_key private key of the zone | 679 | * @param zone_key private key of the zone |
679 | * @param iter iterator to call with the result | 680 | * @param iter iterator to call with the result |
680 | * @param iter_cls closure for 'iter' | 681 | * @param iter_cls closure for @a iter |
681 | * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error | 682 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error |
682 | */ | 683 | */ |
683 | static int | 684 | static int |
684 | get_record_and_call_iterator (struct Plugin *plugin, | 685 | get_record_and_call_iterator (struct Plugin *plugin, |
@@ -724,6 +725,7 @@ get_record_and_call_iterator (struct Plugin *plugin, | |||
724 | { | 725 | { |
725 | iter (iter_cls, zone_key, label, | 726 | iter (iter_cls, zone_key, label, |
726 | record_count, rd); | 727 | record_count, rd); |
728 | ret = GNUNET_YES; | ||
727 | } | 729 | } |
728 | } | 730 | } |
729 | } | 731 | } |
@@ -731,7 +733,6 @@ get_record_and_call_iterator (struct Plugin *plugin, | |||
731 | { | 733 | { |
732 | if (SQLITE_DONE != sret) | 734 | if (SQLITE_DONE != sret) |
733 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); | 735 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); |
734 | iter (iter_cls, NULL, NULL, 0, NULL); | ||
735 | } | 736 | } |
736 | if (SQLITE_OK != sqlite3_reset (stmt)) | 737 | if (SQLITE_OK != sqlite3_reset (stmt)) |
737 | LOG_SQLITE (plugin, | 738 | LOG_SQLITE (plugin, |
@@ -749,8 +750,8 @@ get_record_and_call_iterator (struct Plugin *plugin, | |||
749 | * @param zone hash of public key of the zone, NULL to iterate over all zones | 750 | * @param zone hash of public key of the zone, NULL to iterate over all zones |
750 | * @param offset offset in the list of all matching records | 751 | * @param offset offset in the list of all matching records |
751 | * @param iter function to call with the result | 752 | * @param iter function to call with the result |
752 | * @param iter_cls closure for iter | 753 | * @param iter_cls closure for @a iter |
753 | * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error | 754 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error |
754 | */ | 755 | */ |
755 | static int | 756 | static int |
756 | namestore_sqlite_iterate_records (void *cls, | 757 | namestore_sqlite_iterate_records (void *cls, |
@@ -789,8 +790,8 @@ namestore_sqlite_iterate_records (void *cls, | |||
789 | * @param zone private key of the zone to look up in, never NULL | 790 | * @param zone private key of the zone to look up in, never NULL |
790 | * @param value_zone public key of the target zone (value), never NULL | 791 | * @param value_zone public key of the target zone (value), never NULL |
791 | * @param iter function to call with the result | 792 | * @param iter function to call with the result |
792 | * @param iter_cls closure for iter | 793 | * @param iter_cls closure for @a iter |
793 | * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error | 794 | * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error |
794 | */ | 795 | */ |
795 | static int | 796 | static int |
796 | namestore_sqlite_zone_to_name (void *cls, | 797 | namestore_sqlite_zone_to_name (void *cls, |
@@ -825,7 +826,7 @@ namestore_sqlite_zone_to_name (void *cls, | |||
825 | * Entry point for the plugin. | 826 | * Entry point for the plugin. |
826 | * | 827 | * |
827 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" | 828 | * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*" |
828 | * @return NULL on error, othrewise the plugin context | 829 | * @return NULL on error, otherwise the plugin context |
829 | */ | 830 | */ |
830 | void * | 831 | void * |
831 | libgnunet_plugin_namestore_sqlite_init (void *cls) | 832 | libgnunet_plugin_namestore_sqlite_init (void *cls) |
@@ -868,8 +869,6 @@ libgnunet_plugin_namestore_sqlite_done (void *cls) | |||
868 | struct GNUNET_NAMESTORE_PluginFunctions *api = cls; | 869 | struct GNUNET_NAMESTORE_PluginFunctions *api = cls; |
869 | struct Plugin *plugin = api->cls; | 870 | struct Plugin *plugin = api->cls; |
870 | 871 | ||
871 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
872 | "sqlite plugin is done\n"); | ||
873 | database_shutdown (plugin); | 872 | database_shutdown (plugin); |
874 | plugin->cfg = NULL; | 873 | plugin->cfg = NULL; |
875 | GNUNET_free (api); | 874 | GNUNET_free (api); |