![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Template helper for populating provenance mappings from SPI results. More...
#include "executor/spi.h"#include "provsql_utils_cpp.h"#include "CircuitFromMMap.h"#include "Circuit.hpp"

Go to the source code of this file.
Functions | |
| template<typename T > | |
| void | initialize_provenance_mapping (const constants_t &constants, GenericCircuit &c, std::unordered_map< gate_t, T > &provenance_mapping, const std::function< T(const char *)> &charp_to_value, bool drop_table) |
| Populate a provenance mapping from the current SPI result set. | |
Variables | |
| const char * | drop_temp_table |
| DROP TABLE statement for the per-query temporary provenance mapping table. | |
Template helper for populating provenance mappings from SPI results.
When evaluating a provenance circuit over a user-defined semiring, the first step is to build a provenance_mapping that maps each input gate to its semiring value. The values come from a database table or temporary view queried via SPI; this template handles the SPI-result iteration that is common to all semiring types.
After reading the SPI result set, the function optionally drops the temporary helper table (if drop_table is true) and closes the SPI connection.
Definition in file provenance_evaluate_compiled.hpp.
| void initialize_provenance_mapping | ( | const constants_t & | constants, |
| GenericCircuit & | c, | ||
| std::unordered_map< gate_t, T > & | provenance_mapping, | ||
| const std::function< T(const char *)> & | charp_to_value, | ||
| bool | drop_table | ||
| ) |
Populate a provenance mapping from the current SPI result set.
Iterates over the rows returned by the most recent SPI query. Each row is expected to have two columns:
The charp_to_value converter is called on the text of column 1 to produce the corresponding T value.
| T | Semiring value type. |
| constants | Cached OID constants (used to verify column types). |
| c | The GenericCircuit used to resolve gate IDs. |
| provenance_mapping | Output map from gate IDs to semiring values; entries are added by this function. |
| charp_to_value | Converter from the column-1 text to a T value. |
| drop_table | If true, execute the drop_temp_table SQL statement after processing all rows. |
Definition at line 50 of file provenance_evaluate_compiled.hpp.

|
extern |
DROP TABLE statement for the per-query temporary provenance mapping table.
Definition at line 51 of file provenance_evaluate_compiled.cpp.