ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
to_prov.cpp File Reference

SQL function provsql.to_provxml() – XML/JSON circuit export. More...

#include "postgres.h"
#include "fmgr.h"
#include "catalog/pg_type.h"
#include "utils/uuid.h"
#include "provsql_shmem.h"
#include "provsql_utils.h"
#include <set>
#include <csignal>
#include <utility>
#include <sstream>
#include <list>
#include <algorithm>
#include "provenance_evaluate_compiled.hpp"
Include dependency graph for to_prov.cpp:

Go to the source code of this file.

Functions

static string xmlEscape (const std::string &input)
 Escape special XML characters in input.
 
bool join_with_temp_uuids (Oid table, const std::vector< std::string > &uuids)
 Join a provenance mapping table with a set of UUIDs using SPI.
 
static string to_provxml_internal (Datum tokenDatum, Datum table)
 Build an XML provenance representation for a circuit token.
 
Datum to_provxml (PG_FUNCTION_ARGS)
 PostgreSQL-callable wrapper for to_provxml().
 

Variables

const char * drop_temp_table
 DROP TABLE statement for the per-query temporary provenance mapping table.
 

Detailed Description

SQL function provsql.to_provxml() – XML/JSON circuit export.

Implements provsql.to_provxml(), which serialises the provenance circuit rooted at a given UUID token to an XML string. The XML representation can be used for export, interchange, or display.

The implementation retrieves the circuit from the mmap store via SPI, traverses it depth-first, and builds the XML document using string operations. Special XML characters in node labels are escaped by the local xmlEscape() helper.

Definition in file to_prov.cpp.

Function Documentation

◆ join_with_temp_uuids()

bool join_with_temp_uuids ( Oid  table,
const std::vector< std::string > &  uuids 
)

Join a provenance mapping table with a set of UUIDs using SPI.

Parameters
tableOID of the provenance mapping relation.
uuidsList of UUID strings to join against.
Returns
true if a temporary table was created (caller must drop it).

Definition at line 245 of file provenance_evaluate_compiled.cpp.

Here is the caller graph for this function:

◆ to_provxml()

Datum to_provxml ( PG_FUNCTION_ARGS  )

PostgreSQL-callable wrapper for to_provxml().

Definition at line 136 of file to_prov.cpp.

Here is the call graph for this function:

◆ to_provxml_internal()

static string to_provxml_internal ( Datum  tokenDatum,
Datum  table 
)
static

Build an XML provenance representation for a circuit token.

Parameters
tokenDatumDatum containing the root provenance gate UUID.
tableDatum with the OID of the provenance mapping table.
Returns
XML string describing the provenance circuit.

Definition at line 65 of file to_prov.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xmlEscape()

static string xmlEscape ( const std::string &  input)
static

Escape special XML characters in input.

Parameters
inputString to escape.
Returns
Escaped string suitable for embedding in XML.

Definition at line 42 of file to_prov.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ drop_temp_table

const char* drop_temp_table
extern

DROP TABLE statement for the per-query temporary provenance mapping table.

Definition at line 51 of file provenance_evaluate_compiled.cpp.