diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-01-17 02:26:21 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-01-17 02:26:21 +0100 |
commit | 4353432b97bdc03ce31f11dfd1ff3e30cf0106af (patch) | |
tree | f6d92c64b324e30065051259b73e23e12f4c533f /src/include/gnunet_pq_lib.h | |
parent | 1126181ab98fd7e9e6cca0786939020b161fcb94 (diff) | |
download | gnunet-4353432b97bdc03ce31f11dfd1ff3e30cf0106af.tar.gz gnunet-4353432b97bdc03ce31f11dfd1ff3e30cf0106af.zip |
DB load API change
Diffstat (limited to 'src/include/gnunet_pq_lib.h')
-rw-r--r-- | src/include/gnunet_pq_lib.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index 2aea77b7f..8b32a9265 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h | |||
@@ -708,15 +708,22 @@ GNUNET_PQ_exec_statements (struct GNUNET_PQ_Context *db, | |||
708 | 708 | ||
709 | 709 | ||
710 | /** | 710 | /** |
711 | * Create a connection to the Postgres database using @a config_str | 711 | * Create a connection to the Postgres database using @a config_str for the |
712 | * for the configuration. Initialize logging via GNUnet's log | 712 | * configuration. Initialize logging via GNUnet's log routines and disable |
713 | * routines and disable Postgres's logger. Also ensures that the | 713 | * Postgres's logger. Also ensures that the statements in @a load_path and @a |
714 | * statements in @a es are executed whenever we (re)connect to the | 714 | * es are executed whenever we (re)connect to the database, and that the |
715 | * database, and that the prepared statements in @a ps are "ready". | 715 | * prepared statements in @a ps are "ready". If statements in @es fail that |
716 | * If statements in @es fail that were created with | 716 | * were created with #GNUNET_PQ_make_execute(), then the entire operation |
717 | * #GNUNET_PQ_make_execute(), then the entire operation fails. | 717 | * fails. |
718 | * | ||
719 | * In @a load_path, a list of "$XXXX.sql" files is expected where $XXXX | ||
720 | * must be a sequence of contiguous integer values starting at 0000. | ||
721 | * These files are then loaded in sequence using "psql $config_str" before | ||
722 | * running statements from @e es. The directory is inspected again on | ||
723 | * reconnect. | ||
718 | * | 724 | * |
719 | * @param config_str configuration to use | 725 | * @param config_str configuration to use |
726 | * @param load_path path to directory with SQL transactions to run, can be NULL | ||
720 | * @param es #GNUNET_PQ_PREPARED_STATEMENT_END-terminated | 727 | * @param es #GNUNET_PQ_PREPARED_STATEMENT_END-terminated |
721 | * array of statements to execute upon EACH connection, can be NULL | 728 | * array of statements to execute upon EACH connection, can be NULL |
722 | * @param ps array of prepared statements to prepare, can be NULL | 729 | * @param ps array of prepared statements to prepare, can be NULL |
@@ -724,6 +731,7 @@ GNUNET_PQ_exec_statements (struct GNUNET_PQ_Context *db, | |||
724 | */ | 731 | */ |
725 | struct GNUNET_PQ_Context * | 732 | struct GNUNET_PQ_Context * |
726 | GNUNET_PQ_connect (const char *config_str, | 733 | GNUNET_PQ_connect (const char *config_str, |
734 | const char *load_path, | ||
727 | const struct GNUNET_PQ_ExecuteStatement *es, | 735 | const struct GNUNET_PQ_ExecuteStatement *es, |
728 | const struct GNUNET_PQ_PreparedStatement *ps); | 736 | const struct GNUNET_PQ_PreparedStatement *ps); |
729 | 737 | ||