diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-21 16:24:44 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-21 16:24:44 +0000 |
commit | 3101c3cb4276e33edacdf5cb5cff546d21b90cc9 (patch) | |
tree | 3b543a36791044fd496a2260bda3613016bc4cf0 /src | |
parent | 53e8b875ee273ad37840bca8499fff655f0d6e47 (diff) | |
download | gnunet-3101c3cb4276e33edacdf5cb5cff546d21b90cc9.tar.gz gnunet-3101c3cb4276e33edacdf5cb5cff546d21b90cc9.zip |
-again improving API, starting to implement some of the sqlite interactions
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_namestore_plugin.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_namestore_service.h | 6 | ||||
-rw-r--r-- | src/namestore/plugin_namestore_sqlite.c | 166 |
3 files changed, 137 insertions, 37 deletions
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h index d19c3aeb2..111be7e47 100644 --- a/src/include/gnunet_namestore_plugin.h +++ b/src/include/gnunet_namestore_plugin.h | |||
@@ -145,7 +145,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
145 | * @param cls closure (internal context for the plugin) | 145 | * @param cls closure (internal context for the plugin) |
146 | * @param zone hash of public key of the zone | 146 | * @param zone hash of public key of the zone |
147 | * @param loc location in the B-tree | 147 | * @param loc location in the B-tree |
148 | * @param ploc parent's location in the B-tree (must have depth = loc.depth - 1) and the | 148 | * @param ploc parent's location in the B-tree (must have depth = loc.depth + 1) and the |
149 | * revision must also match loc's revision; NULL for root | 149 | * revision must also match loc's revision; NULL for root |
150 | * @param num_entries number of entries at this node in the B-tree | 150 | * @param num_entries number of entries at this node in the B-tree |
151 | * @param entries the 'num_entries' entries to store (hashes over the | 151 | * @param entries the 'num_entries' entries to store (hashes over the |
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 10316594b..fe406abd9 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -493,9 +493,9 @@ typedef void (*GNUNET_NAMESTORE_SignatureProcessor) (void *cls, | |||
493 | * cancel | 493 | * cancel |
494 | */ | 494 | */ |
495 | struct GNUNET_NAMESTORE_QueueEntry * | 495 | struct GNUNET_NAMESTORE_QueueEntry * |
496 | GNUNET_NAMESTORE_lookup_stree (struct GNUNET_NAMESTORE_Handle *h, | 496 | GNUNET_NAMESTORE_lookup_signature (struct GNUNET_NAMESTORE_Handle *h, |
497 | const GNUNET_HashCode *zone, | 497 | const GNUNET_HashCode *zone, |
498 | GNUNET_NAMESTORE_StreeProcessor proc, void *proc_cls); | 498 | GNUNET_NAMESTORE_SignatureProcessor proc, void *proc_cls); |
499 | 499 | ||
500 | 500 | ||
501 | /** | 501 | /** |
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index bb51f093c..ff0875ea6 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c | |||
@@ -46,7 +46,7 @@ | |||
46 | * a failure of the command 'cmd' on file 'filename' | 46 | * a failure of the command 'cmd' on file 'filename' |
47 | * with the message given by strerror(errno). | 47 | * with the message given by strerror(errno). |
48 | */ | 48 | */ |
49 | #define LOG_SQLITE(db, msg, level, cmd) do { GNUNET_log_from (level, "namestore-sqlite", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, sqlite3_errmsg(db->dbh)); if (msg != NULL) GNUNET_asprintf(msg, _("`%s' failed at %s:%u with error: %s"), cmd, __FILE__, __LINE__, sqlite3_errmsg(db->dbh)); } while(0) | 49 | #define LOG_SQLITE(db, level, cmd) do { GNUNET_log_from (level, "namestore-sqlite", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, sqlite3_errmsg(db->dbh)); } while(0) |
50 | 50 | ||
51 | #define LOG(kind,...) GNUNET_log_from (kind, "namestore-sqlite", __VA_ARGS__) | 51 | #define LOG(kind,...) GNUNET_log_from (kind, "namestore-sqlite", __VA_ARGS__) |
52 | 52 | ||
@@ -279,7 +279,7 @@ database_setup (struct Plugin *plugin) | |||
279 | ")", | 279 | ")", |
280 | NULL, NULL, NULL) != SQLITE_OK)) | 280 | NULL, NULL, NULL) != SQLITE_OK)) |
281 | { | 281 | { |
282 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); | 282 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); |
283 | sqlite3_finalize (stmt); | 283 | sqlite3_finalize (stmt); |
284 | return GNUNET_SYSERR; | 284 | return GNUNET_SYSERR; |
285 | } | 285 | } |
@@ -302,7 +302,7 @@ database_setup (struct Plugin *plugin) | |||
302 | ")", | 302 | ")", |
303 | NULL, NULL, NULL) != SQLITE_OK)) | 303 | NULL, NULL, NULL) != SQLITE_OK)) |
304 | { | 304 | { |
305 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); | 305 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); |
306 | sqlite3_finalize (stmt); | 306 | sqlite3_finalize (stmt); |
307 | return GNUNET_SYSERR; | 307 | return GNUNET_SYSERR; |
308 | } | 308 | } |
@@ -327,7 +327,7 @@ database_setup (struct Plugin *plugin) | |||
327 | ")", | 327 | ")", |
328 | NULL, NULL, NULL) != SQLITE_OK)) | 328 | NULL, NULL, NULL) != SQLITE_OK)) |
329 | { | 329 | { |
330 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); | 330 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); |
331 | sqlite3_finalize (stmt); | 331 | sqlite3_finalize (stmt); |
332 | return GNUNET_SYSERR; | 332 | return GNUNET_SYSERR; |
333 | } | 333 | } |
@@ -383,7 +383,7 @@ database_setup (struct Plugin *plugin) | |||
383 | "DELETE FROM gn090signatures WHERE zone_hash=?", | 383 | "DELETE FROM gn090signatures WHERE zone_hash=?", |
384 | &plugin->delete_zone_signatures) != SQLITE_OK) ) | 384 | &plugin->delete_zone_signatures) != SQLITE_OK) ) |
385 | { | 385 | { |
386 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "precompiling"); | 386 | LOG_SQLITE (plugin,GNUNET_ERROR_TYPE_ERROR, "precompiling"); |
387 | return GNUNET_SYSERR; | 387 | return GNUNET_SYSERR; |
388 | } | 388 | } |
389 | return GNUNET_OK; | 389 | return GNUNET_OK; |
@@ -438,7 +438,7 @@ database_shutdown (struct Plugin *plugin) | |||
438 | result = sqlite3_close (plugin->dbh); | 438 | result = sqlite3_close (plugin->dbh); |
439 | } | 439 | } |
440 | if (SQLITE_OK != result) | 440 | if (SQLITE_OK != result) |
441 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite3_close"); | 441 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_close"); |
442 | 442 | ||
443 | GNUNET_free_non_null (plugin->fn); | 443 | GNUNET_free_non_null (plugin->fn); |
444 | } | 444 | } |
@@ -470,43 +470,52 @@ namestore_sqlite_put_record (void *cls, | |||
470 | size_t data_size, | 470 | size_t data_size, |
471 | const void *data) | 471 | const void *data) |
472 | { | 472 | { |
473 | #if 0 | ||
474 | struct Plugin *plugin = cls; | 473 | struct Plugin *plugin = cls; |
475 | int n; | 474 | int n; |
476 | 475 | GNUNET_HashCode nh; | |
477 | if ((SQLITE_OK != sqlite3_bind_int (plugin->updPrio, 1, delta)) || | 476 | size_t name_len; |
478 | (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 2, expire.abs_value)) | 477 | |
479 | || (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 3, uid))) | 478 | name_len = strlen (name); |
479 | GNUNET_CRYPTO_hash (name, name_len, &nh); | ||
480 | if ((SQLITE_OK != sqlite3_bind_blob (plugin->put_record, 1, zone, sizeof (GNUNET_HashCode), SQLITE_STATIC)) || | ||
481 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_record, 2, loc->revision)) || | ||
482 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_record, 3, &nh, sizeof (GNUNET_HashCode), SQLITE_STATIC)) || | ||
483 | (SQLITE_OK != sqlite3_bind_text (plugin->put_record, 4, name, name_len, SQLITE_STATIC)) || | ||
484 | (SQLITE_OK != sqlite3_bind_int (plugin->put_record, 5, record_type)) || | ||
485 | (SQLITE_OK != sqlite3_bind_int (plugin->put_record, 6, loc->depth)) || | ||
486 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_record, 7, loc->offset)) || | ||
487 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_record, 8, expiration.abs_value)) || | ||
488 | (SQLITE_OK != sqlite3_bind_int (plugin->put_record, 9, flags)) || | ||
489 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_record, 10, data, data_size, SQLITE_STATIC)) ) | ||
480 | { | 490 | { |
481 | LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 491 | LOG_SQLITE (plugin, |
492 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
482 | "sqlite3_bind_XXXX"); | 493 | "sqlite3_bind_XXXX"); |
483 | if (SQLITE_OK != sqlite3_reset (plugin->updPrio)) | 494 | if (SQLITE_OK != sqlite3_reset (plugin->put_record)) |
484 | LOG_SQLITE (plugin, NULL, | 495 | LOG_SQLITE (plugin, |
485 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 496 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
486 | "sqlite3_reset"); | 497 | "sqlite3_reset"); |
487 | return GNUNET_SYSERR; | 498 | return GNUNET_SYSERR; |
488 | 499 | ||
489 | } | 500 | } |
490 | n = sqlite3_step (plugin->updPrio); | 501 | n = sqlite3_step (plugin->put_record); |
491 | if (SQLITE_OK != sqlite3_reset (plugin->updPrio)) | 502 | if (SQLITE_OK != sqlite3_reset (plugin->put_record)) |
492 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 503 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
493 | "sqlite3_reset"); | 504 | "sqlite3_reset"); |
494 | switch (n) | 505 | switch (n) |
495 | { | 506 | { |
496 | case SQLITE_DONE: | 507 | case SQLITE_DONE: |
497 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Block updated\n"); | 508 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Record stored\n"); |
498 | return GNUNET_OK; | 509 | return GNUNET_OK; |
499 | case SQLITE_BUSY: | 510 | case SQLITE_BUSY: |
500 | LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, | 511 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, |
501 | "sqlite3_step"); | 512 | "sqlite3_step"); |
502 | return GNUNET_NO; | 513 | return GNUNET_NO; |
503 | default: | 514 | default: |
504 | LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 515 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
505 | "sqlite3_step"); | 516 | "sqlite3_step"); |
506 | return GNUNET_SYSERR; | 517 | return GNUNET_SYSERR; |
507 | } | 518 | } |
508 | #endif | ||
509 | return GNUNET_SYSERR; | ||
510 | } | 519 | } |
511 | 520 | ||
512 | 521 | ||
@@ -516,7 +525,7 @@ namestore_sqlite_put_record (void *cls, | |||
516 | * @param cls closure (internal context for the plugin) | 525 | * @param cls closure (internal context for the plugin) |
517 | * @param zone hash of public key of the zone | 526 | * @param zone hash of public key of the zone |
518 | * @param loc location in the B-tree | 527 | * @param loc location in the B-tree |
519 | * @param ploc parent's location in the B-tree (must have depth = loc.depth - 1), NULL for root | 528 | * @param ploc parent's location in the B-tree (must have depth = loc.depth + 1), NULL for root |
520 | * @param num_entries number of entries at this node in the B-tree | 529 | * @param num_entries number of entries at this node in the B-tree |
521 | * @param entries the 'num_entries' entries to store (hashes over the | 530 | * @param entries the 'num_entries' entries to store (hashes over the |
522 | * records) | 531 | * records) |
@@ -530,7 +539,50 @@ namestore_sqlite_put_node (void *cls, | |||
530 | unsigned int num_entries, | 539 | unsigned int num_entries, |
531 | const GNUNET_HashCode *entries) | 540 | const GNUNET_HashCode *entries) |
532 | { | 541 | { |
533 | return GNUNET_SYSERR; | 542 | struct Plugin *plugin = cls; |
543 | int n; | ||
544 | |||
545 | if ( (loc->revision != ploc->revision) || | ||
546 | (loc->depth + 1 != ploc->depth) || | ||
547 | (0 == num_entries)) | ||
548 | { | ||
549 | GNUNET_break (0); | ||
550 | return GNUNET_SYSERR; | ||
551 | } | ||
552 | if ((SQLITE_OK != sqlite3_bind_blob (plugin->put_node, 1, zone, sizeof (GNUNET_HashCode), SQLITE_STATIC)) || | ||
553 | (SQLITE_OK != sqlite3_bind_int (plugin->put_node, 2, loc->revision)) || | ||
554 | (SQLITE_OK != sqlite3_bind_int (plugin->put_node, 3, loc->depth)) || | ||
555 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_node, 4, loc->offset)) || | ||
556 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_node, 5, ploc->offset)) || | ||
557 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_node, 6, entries, num_entries * sizeof (GNUNET_HashCode), SQLITE_STATIC)) ) | ||
558 | { | ||
559 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
560 | "sqlite3_bind_XXXX"); | ||
561 | if (SQLITE_OK != sqlite3_reset (plugin->put_node)) | ||
562 | LOG_SQLITE (plugin, | ||
563 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
564 | "sqlite3_reset"); | ||
565 | return GNUNET_SYSERR; | ||
566 | |||
567 | } | ||
568 | n = sqlite3_step (plugin->put_node); | ||
569 | if (SQLITE_OK != sqlite3_reset (plugin->put_node)) | ||
570 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
571 | "sqlite3_reset"); | ||
572 | switch (n) | ||
573 | { | ||
574 | case SQLITE_DONE: | ||
575 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Node stored\n"); | ||
576 | return GNUNET_OK; | ||
577 | case SQLITE_BUSY: | ||
578 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, | ||
579 | "sqlite3_step"); | ||
580 | return GNUNET_NO; | ||
581 | default: | ||
582 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
583 | "sqlite3_step"); | ||
584 | return GNUNET_SYSERR; | ||
585 | } | ||
534 | } | 586 | } |
535 | 587 | ||
536 | 588 | ||
@@ -556,7 +608,52 @@ namestore_sqlite_put_signature (void *cls, | |||
556 | const GNUNET_HashCode *root_hash, | 608 | const GNUNET_HashCode *root_hash, |
557 | struct GNUNET_TIME_Absolute zone_time) | 609 | struct GNUNET_TIME_Absolute zone_time) |
558 | { | 610 | { |
559 | return GNUNET_SYSERR; | 611 | struct Plugin *plugin = cls; |
612 | int n; | ||
613 | GNUNET_HashCode zone; | ||
614 | |||
615 | GNUNET_CRYPTO_hash (zone_key, | ||
616 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | ||
617 | &zone); | ||
618 | /* FIXME: get "old" signature, if older revision, delete all existing | ||
619 | records/nodes for the zone, if same revision, delete only the signature */ | ||
620 | |||
621 | |||
622 | if ((SQLITE_OK != sqlite3_bind_blob (plugin->put_signature, 1, &zone, sizeof (GNUNET_HashCode), SQLITE_STATIC)) || | ||
623 | (SQLITE_OK != sqlite3_bind_int (plugin->put_signature, 2, loc->revision)) || | ||
624 | (SQLITE_OK != sqlite3_bind_int64 (plugin->put_signature, 3, zone_time.abs_value)) || | ||
625 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_signature, 4, root_hash, sizeof (GNUNET_HashCode), SQLITE_STATIC)) || | ||
626 | (SQLITE_OK != sqlite3_bind_int (plugin->put_signature, 5, loc->depth)) || | ||
627 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_signature, 6, zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), SQLITE_STATIC))|| | ||
628 | (SQLITE_OK != sqlite3_bind_blob (plugin->put_signature, 7, top_sig, sizeof (struct GNUNET_CRYPTO_RsaSignature), SQLITE_STATIC)) ) | ||
629 | { | ||
630 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
631 | "sqlite3_bind_XXXX"); | ||
632 | if (SQLITE_OK != sqlite3_reset (plugin->put_signature)) | ||
633 | LOG_SQLITE (plugin, | ||
634 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
635 | "sqlite3_reset"); | ||
636 | return GNUNET_SYSERR; | ||
637 | |||
638 | } | ||
639 | n = sqlite3_step (plugin->put_signature); | ||
640 | if (SQLITE_OK != sqlite3_reset (plugin->put_signature)) | ||
641 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
642 | "sqlite3_reset"); | ||
643 | switch (n) | ||
644 | { | ||
645 | case SQLITE_DONE: | ||
646 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Signature stored\n"); | ||
647 | return GNUNET_OK; | ||
648 | case SQLITE_BUSY: | ||
649 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, | ||
650 | "sqlite3_step"); | ||
651 | return GNUNET_NO; | ||
652 | default: | ||
653 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | ||
654 | "sqlite3_step"); | ||
655 | return GNUNET_SYSERR; | ||
656 | } | ||
560 | } | 657 | } |
561 | 658 | ||
562 | 659 | ||
@@ -598,7 +695,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
598 | _ | 695 | _ |
599 | ("Invalid data in database. Trying to fix (by deletion).\n")); | 696 | ("Invalid data in database. Trying to fix (by deletion).\n")); |
600 | if (SQLITE_OK != sqlite3_reset (stmt)) | 697 | if (SQLITE_OK != sqlite3_reset (stmt)) |
601 | LOG_SQLITE (plugin, NULL, | 698 | LOG_SQLITE (plugin, |
602 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 699 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
603 | "sqlite3_reset"); | 700 | "sqlite3_reset"); |
604 | if (GNUNET_OK == delete_by_rowid (plugin, rowid)) | 701 | if (GNUNET_OK == delete_by_rowid (plugin, rowid)) |
@@ -619,7 +716,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
619 | sqlite3_column_int (stmt, 2) /* anonymity */ , | 716 | sqlite3_column_int (stmt, 2) /* anonymity */ , |
620 | expiration, rowid); | 717 | expiration, rowid); |
621 | if (SQLITE_OK != sqlite3_reset (stmt)) | 718 | if (SQLITE_OK != sqlite3_reset (stmt)) |
622 | LOG_SQLITE (plugin, NULL, | 719 | LOG_SQLITE (plugin, |
623 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 720 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
624 | "sqlite3_reset"); | 721 | "sqlite3_reset"); |
625 | if ((GNUNET_NO == ret) && (GNUNET_OK == delete_by_rowid (plugin, rowid))) | 722 | if ((GNUNET_NO == ret) && (GNUNET_OK == delete_by_rowid (plugin, rowid))) |
@@ -629,7 +726,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
629 | case SQLITE_DONE: | 726 | case SQLITE_DONE: |
630 | /* database must be empty */ | 727 | /* database must be empty */ |
631 | if (SQLITE_OK != sqlite3_reset (stmt)) | 728 | if (SQLITE_OK != sqlite3_reset (stmt)) |
632 | LOG_SQLITE (plugin, NULL, | 729 | LOG_SQLITE (plugin, |
633 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 730 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
634 | "sqlite3_reset"); | 731 | "sqlite3_reset"); |
635 | break; | 732 | break; |
@@ -637,10 +734,10 @@ namestore_sqlite_iterate_records (void *cls, | |||
637 | case SQLITE_ERROR: | 734 | case SQLITE_ERROR: |
638 | case SQLITE_MISUSE: | 735 | case SQLITE_MISUSE: |
639 | default: | 736 | default: |
640 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 737 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
641 | "sqlite3_step"); | 738 | "sqlite3_step"); |
642 | if (SQLITE_OK != sqlite3_reset (stmt)) | 739 | if (SQLITE_OK != sqlite3_reset (stmt)) |
643 | LOG_SQLITE (plugin, NULL, | 740 | LOG_SQLITE (plugin, |
644 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 741 | GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
645 | "sqlite3_reset"); | 742 | "sqlite3_reset"); |
646 | GNUNET_break (0); | 743 | GNUNET_break (0); |
@@ -649,7 +746,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
649 | break; | 746 | break; |
650 | } | 747 | } |
651 | if (SQLITE_OK != sqlite3_reset (stmt)) | 748 | if (SQLITE_OK != sqlite3_reset (stmt)) |
652 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 749 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
653 | "sqlite3_reset"); | 750 | "sqlite3_reset"); |
654 | proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); | 751 | proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); |
655 | 752 | ||
@@ -664,7 +761,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
664 | GNUNET_assert (proc != NULL); | 761 | GNUNET_assert (proc != NULL); |
665 | if (sq_prepare (plugin->dbh, "SELECT hash FROM gn090", &stmt) != SQLITE_OK) | 762 | if (sq_prepare (plugin->dbh, "SELECT hash FROM gn090", &stmt) != SQLITE_OK) |
666 | { | 763 | { |
667 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 764 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
668 | "sqlite_prepare"); | 765 | "sqlite_prepare"); |
669 | return; | 766 | return; |
670 | } | 767 | } |
@@ -675,7 +772,7 @@ namestore_sqlite_iterate_records (void *cls, | |||
675 | proc (proc_cls, key, 1); | 772 | proc (proc_cls, key, 1); |
676 | } | 773 | } |
677 | if (SQLITE_DONE != ret) | 774 | if (SQLITE_DONE != ret) |
678 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); | 775 | LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); |
679 | sqlite3_finalize (stmt); | 776 | sqlite3_finalize (stmt); |
680 | 777 | ||
681 | #endif | 778 | #endif |
@@ -698,6 +795,7 @@ namestore_sqlite_get_node (void *cls, | |||
698 | const struct GNUNET_NAMESTORE_SignatureLocation *loc, | 795 | const struct GNUNET_NAMESTORE_SignatureLocation *loc, |
699 | GNUNET_NAMESTORE_NodeCallback cb, void *cb_cls) | 796 | GNUNET_NAMESTORE_NodeCallback cb, void *cb_cls) |
700 | { | 797 | { |
798 | // FIXME | ||
701 | } | 799 | } |
702 | 800 | ||
703 | 801 | ||
@@ -714,6 +812,7 @@ namestore_sqlite_get_signature (void *cls, | |||
714 | const GNUNET_HashCode *zone, | 812 | const GNUNET_HashCode *zone, |
715 | GNUNET_NAMESTORE_SignatureCallback cb, void *cb_cls) | 813 | GNUNET_NAMESTORE_SignatureCallback cb, void *cb_cls) |
716 | { | 814 | { |
815 | // FIXME | ||
717 | } | 816 | } |
718 | 817 | ||
719 | 818 | ||
@@ -728,6 +827,7 @@ static void | |||
728 | namestore_sqlite_delete_zone (void *cls, | 827 | namestore_sqlite_delete_zone (void *cls, |
729 | const GNUNET_HashCode *zone) | 828 | const GNUNET_HashCode *zone) |
730 | { | 829 | { |
830 | // FIXME | ||
731 | } | 831 | } |
732 | 832 | ||
733 | 833 | ||