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

Aggregate-provenance token type used in SQL aggregate functions. More...

#include "provsql_utils.h"
Include dependency graph for agg_token.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  agg_token
 Aggregate token bundling a provenance UUID with a running value. More...

Macros

#define AGG_TOKEN_PREFIX_LEN   (sizeof(((agg_token *)0)->val) - 2)
 Length of the prefix of a value too long for agg_token::val.
#define AGG_TOKEN_TRUNCATED   '\x01'
 Last byte of agg_token::val when the value is a prefix.

Functions

void agg_token_set_value (agg_token *aggtok, const char *val, size_t len)
 Set the value of aggtok to the len first bytes of val.
const char * agg_token_value_cstring (const agg_token *aggtok)
 The value of aggtok, as a C string.

Detailed Description

Aggregate-provenance token type used in SQL aggregate functions.

Defines the agg_token composite type that pairs a provenance circuit UUID (as a hex string) with an aggregate running value. It is passed between the transition and final functions of ProvSQL's custom aggregate operators so that both the provenance token and its associated numeric value travel together through a GROUP BY query.

Definition in file agg_token.h.

Macro Definition Documentation

◆ AGG_TOKEN_PREFIX_LEN

#define AGG_TOKEN_PREFIX_LEN   (sizeof(((agg_token *)0)->val) - 2)

Length of the prefix of a value too long for agg_token::val.

Definition at line 38 of file agg_token.h.

◆ AGG_TOKEN_TRUNCATED

#define AGG_TOKEN_TRUNCATED   '\x01'

Last byte of agg_token::val when the value is a prefix.

Definition at line 40 of file agg_token.h.

Function Documentation

◆ agg_token_set_value()

void agg_token_set_value ( agg_token * aggtok,
const char * val,
size_t len )

Set the value of aggtok to the len first bytes of val.

A value too long for agg_token::val keeps its first AGG_TOKEN_PREFIX_LEN bytes, marked by AGG_TOKEN_TRUNCATED in the last byte; aggtok must be zeroed.

Definition at line 36 of file agg_token.c.

Here is the caller graph for this function:

◆ agg_token_value_cstring()

const char * agg_token_value_cstring ( const agg_token * aggtok)

The value of aggtok, as a C string.

The value stored in the token, or, when it is only a prefix, the value of its gate, read with provsql.agg_token_value_text; the prefix is returned if the gate gives none that starts with it.

Definition at line 55 of file agg_token.c.

Here is the caller graph for this function: