set_instance.h (1941B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2026 Taler Systems SA 4 5 TALER 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 7 Foundation; either version 3, or (at your option) any later version. 8 9 TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file src/include/merchant-database/set_instance.h 18 * @brief Select the per-instance schema active on the connection 19 * @author Christian Grothoff 20 */ 21 #ifndef MERCHANT_DATABASE_SET_INSTANCE_H 22 #define MERCHANT_DATABASE_SET_INSTANCE_H 23 24 #include <taler/taler_util.h> 25 #include "merchantdb_lib.h" 26 27 28 /** 29 * Resolve @a instance_id to its merchant_serial and route subsequent 30 * per-instance queries on @a pg to the corresponding 31 * `merchant_instance_<serial>` schema. Updates the connection's 32 * search_path to "merchant_instance_<serial>, merchant" and stores 33 * @a instance_id / serial in the context for use by per-instance 34 * call sites and the #PREPARE_INSTANCE macro. 35 * 36 * Idempotent: a call with an already-active @a instance_id is a no-op. 37 * 38 * @param pg database connection 39 * @param instance_id instance to activate (must be NUL-terminated) 40 * @return #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if the instance was found 41 * and the search_path was updated; 42 * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if no such instance exists; 43 * a hard or soft error code otherwise 44 */ 45 enum GNUNET_DB_QueryStatus 46 TALER_MERCHANTDB_set_instance ( 47 struct TALER_MERCHANTDB_PostgresContext *pg, 48 const char *instance_id); 49 50 51 #endif