diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-06-11 01:23:16 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-06-11 01:33:02 +0200 |
commit | c90ae1921559d990c179800ac392b0a5358758fb (patch) | |
tree | c696cf7e8a8d2f66d24eb221251ab0c05f7c948f /src/include/gnunet_pq_lib.h | |
parent | d71e2f3b35de7fcce36806bdad44ecf4114f6740 (diff) | |
download | gnunet-c90ae1921559d990c179800ac392b0a5358758fb.tar.gz gnunet-c90ae1921559d990c179800ac392b0a5358758fb.zip |
rename GNUNET_PQ_QueryStatus to GNUNET_DB_QueryStatus
Diffstat (limited to 'src/include/gnunet_pq_lib.h')
-rw-r--r-- | src/include/gnunet_pq_lib.h | 52 |
1 files changed, 11 insertions, 41 deletions
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index 0f6b88b78..ed295b500 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2016 GNUnet e.V. | 3 | Copyright (C) 2016, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify it under the | 5 | GNUnet is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU General Public License as published by the Free Software | 6 | terms of the GNU General Public License as published by the Free Software |
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #include <libpq-fe.h> | 24 | #include <libpq-fe.h> |
25 | #include "gnunet_util_lib.h" | 25 | #include "gnunet_util_lib.h" |
26 | 26 | #include "gnunet_db_lib.h" | |
27 | 27 | ||
28 | /* ************************* pq_query_helper.c functions ************************ */ | 28 | /* ************************* pq_query_helper.c functions ************************ */ |
29 | 29 | ||
@@ -466,36 +466,6 @@ GNUNET_PQ_cleanup_result (struct GNUNET_PQ_ResultSpec *rs); | |||
466 | 466 | ||
467 | 467 | ||
468 | /** | 468 | /** |
469 | * Status code returned from functions running PQ commands. | ||
470 | * Can be combined with a function that returns the number | ||
471 | * of results, so non-negative values indicate success. | ||
472 | */ | ||
473 | enum GNUNET_PQ_QueryStatus | ||
474 | { | ||
475 | /** | ||
476 | * A hard error occurred, retrying will not help. | ||
477 | */ | ||
478 | GNUNET_PQ_STATUS_HARD_ERROR = -2, | ||
479 | |||
480 | /** | ||
481 | * A soft error occurred, retrying the transaction may succeed. | ||
482 | */ | ||
483 | GNUNET_PQ_STATUS_SOFT_ERROR = -1, | ||
484 | |||
485 | /** | ||
486 | * The transaction succeeded, but yielded zero results. | ||
487 | */ | ||
488 | GNUNET_PQ_STATUS_SUCCESS_NO_RESULTS = 0, | ||
489 | |||
490 | /** | ||
491 | * The transaction succeeded, and yielded one result. | ||
492 | */ | ||
493 | GNUNET_PQ_STATUS_SUCCESS_ONE_RESULT = 1 | ||
494 | |||
495 | }; | ||
496 | |||
497 | |||
498 | /** | ||
499 | * Check the @a result's error code to see what happened. | 469 | * Check the @a result's error code to see what happened. |
500 | * Also logs errors. | 470 | * Also logs errors. |
501 | * | 471 | * |
@@ -503,12 +473,12 @@ enum GNUNET_PQ_QueryStatus | |||
503 | * @param statement_name name of the statement that created @a result | 473 | * @param statement_name name of the statement that created @a result |
504 | * @param result result to check | 474 | * @param result result to check |
505 | * @return status code from the result, mapping PQ status | 475 | * @return status code from the result, mapping PQ status |
506 | * codes to `enum GNUNET_PQ_QueryStatus`. Never | 476 | * codes to `enum GNUNET_DB_QueryStatus`. Never |
507 | * returns positive values as this function does | 477 | * returns positive values as this function does |
508 | * not look at the result set. | 478 | * not look at the result set. |
509 | * @deprecated (low level, let's see if we can do with just the high-level functions) | 479 | * @deprecated (low level, let's see if we can do with just the high-level functions) |
510 | */ | 480 | */ |
511 | enum GNUNET_PQ_QueryStatus | 481 | enum GNUNET_DB_QueryStatus |
512 | GNUNET_PQ_eval_result (PGconn *connection, | 482 | GNUNET_PQ_eval_result (PGconn *connection, |
513 | const char *statement_name, | 483 | const char *statement_name, |
514 | PGresult *result); | 484 | PGresult *result); |
@@ -523,14 +493,14 @@ GNUNET_PQ_eval_result (PGconn *connection, | |||
523 | * @param statement_name name of the statement | 493 | * @param statement_name name of the statement |
524 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) | 494 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) |
525 | * @return status code from the result, mapping PQ status | 495 | * @return status code from the result, mapping PQ status |
526 | * codes to `enum GNUNET_PQ_QueryStatus`. If the | 496 | * codes to `enum GNUNET_DB_QueryStatus`. If the |
527 | * statement was a DELETE or UPDATE statement, the | 497 | * statement was a DELETE or UPDATE statement, the |
528 | * number of affected rows is returned; if the | 498 | * number of affected rows is returned; if the |
529 | * statment was an INSERT statement, and no row | 499 | * statment was an INSERT statement, and no row |
530 | * was added due to a UNIQUE violation, we return | 500 | * was added due to a UNIQUE violation, we return |
531 | * zero; if INSERT was successful, we return one. | 501 | * zero; if INSERT was successful, we return one. |
532 | */ | 502 | */ |
533 | enum GNUNET_PQ_QueryStatus | 503 | enum GNUNET_DB_QueryStatus |
534 | GNUNET_PQ_eval_prepared_non_select (PGconn *connection, | 504 | GNUNET_PQ_eval_prepared_non_select (PGconn *connection, |
535 | const char *statement_name, | 505 | const char *statement_name, |
536 | const struct GNUNET_PQ_QueryParam *params); | 506 | const struct GNUNET_PQ_QueryParam *params); |
@@ -563,9 +533,9 @@ typedef void | |||
563 | * @param rh function to call with the result set, NULL to ignore | 533 | * @param rh function to call with the result set, NULL to ignore |
564 | * @param rh_cls closure to pass to @a rh | 534 | * @param rh_cls closure to pass to @a rh |
565 | * @return status code from the result, mapping PQ status | 535 | * @return status code from the result, mapping PQ status |
566 | * codes to `enum GNUNET_PQ_QueryStatus`. | 536 | * codes to `enum GNUNET_DB_QueryStatus`. |
567 | */ | 537 | */ |
568 | enum GNUNET_PQ_QueryStatus | 538 | enum GNUNET_DB_QueryStatus |
569 | GNUNET_PQ_eval_prepared_multi_select (PGconn *connection, | 539 | GNUNET_PQ_eval_prepared_multi_select (PGconn *connection, |
570 | const char *statement_name, | 540 | const char *statement_name, |
571 | const struct GNUNET_PQ_QueryParam *params, | 541 | const struct GNUNET_PQ_QueryParam *params, |
@@ -578,7 +548,7 @@ GNUNET_PQ_eval_prepared_multi_select (PGconn *connection, | |||
578 | * which must return a single result in @a connection using the given | 548 | * which must return a single result in @a connection using the given |
579 | * @a params. Stores the result (if any) in @a rs, which the caller | 549 | * @a params. Stores the result (if any) in @a rs, which the caller |
580 | * must then clean up using #GNUNET_PQ_cleanup_result() if the return | 550 | * must then clean up using #GNUNET_PQ_cleanup_result() if the return |
581 | * value was #GNUNET_PQ_STATUS_SUCCESS_ONE_RESULT. Returns the | 551 | * value was #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT. Returns the |
582 | * resulting session status. | 552 | * resulting session status. |
583 | * | 553 | * |
584 | * @param connection connection to execute the statement in | 554 | * @param connection connection to execute the statement in |
@@ -586,9 +556,9 @@ GNUNET_PQ_eval_prepared_multi_select (PGconn *connection, | |||
586 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) | 556 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) |
587 | * @param[in,out] rs result specification to use for storing the result of the query | 557 | * @param[in,out] rs result specification to use for storing the result of the query |
588 | * @return status code from the result, mapping PQ status | 558 | * @return status code from the result, mapping PQ status |
589 | * codes to `enum GNUNET_PQ_QueryStatus`. | 559 | * codes to `enum GNUNET_DB_QueryStatus`. |
590 | */ | 560 | */ |
591 | enum GNUNET_PQ_QueryStatus | 561 | enum GNUNET_DB_QueryStatus |
592 | GNUNET_PQ_eval_prepared_singleton_select (PGconn *connection, | 562 | GNUNET_PQ_eval_prepared_singleton_select (PGconn *connection, |
593 | const char *statement_name, | 563 | const char *statement_name, |
594 | const struct GNUNET_PQ_QueryParam *params, | 564 | const struct GNUNET_PQ_QueryParam *params, |