Author: Marc Munro Copyright (c) 2005, 2006 Marc Munro License: BSD $Id: veil_interface.c,v 1.6 2007/07/31 22:18:27 bloodnok Exp $
Functions providing the SQL interface to veil, and utility functions to support them.
Definition in file veil_interface.c.
#include "postgres.h"
#include "executor/spi.h"
#include "funcapi.h"
#include "utils/hsearch.h"
#include "utils/memutils.h"
#include "veil_version.h"
#include "veil_funcs.h"
#include "veil_datatypes.h"
Include dependency graph for veil_interface.c:
Go to the source code of this file.
Functions | |
const Pg_magic_struct * | Pg_magic_func (void) |
static char * | strfromtext (text *in) |
Create a dynamically allocated C string as a copy of a text value. | |
static text * | textfromstr (char *in) |
Create a dynamically allocated text value as a copy of a C string. | |
static text * | textfromstrn (char *in, int limit) |
Create a dynamically allocated text value as a copy of a C string, applying a limit to the length. | |
static char * | copystr (char *str) |
Create a dynamically allocated text value as a copy of a C string, applying a limit to the length. | |
static char * | strfromint (int4 val) |
Create a dynamically allocated C string as a copy of an integer value. | |
static char * | strfrombool (bool val) |
Create a dynamically allocated C string as a copy of a boolean value. | |
static void | ensure_init () |
Perform session initialisation once for the session. | |
static void | type_mismatch (char *name, ObjType expected, ObjType got) |
Report, by raising an error, a type mismatch between the expected and actual type of a VarEntry variable. | |
static Int4Var * | GetInt4Var (char *name, bool create) |
Return the Int4Var variable matching the name parameter, possibly creating the variable. | |
static Range * | GetRange (char *name, bool create) |
Return the Range variable matching the name parameter, possibly creating the variable. | |
static Bitmap * | GetBitmapFromVar (VarEntry *var, bool allow_empty, bool allow_ref) |
Return the Bitmap from a bitmap variable. | |
static Bitmap * | GetBitmap (char *name, bool allow_empty, bool allow_ref) |
Return the Bitmap matching the name parameter, possibly creating the VarEntry (variable) for it. | |
static BitmapRef * | GetBitmapRefFromVar (VarEntry *var) |
Return the BitmapRef from a bitmap ref variable. | |
static BitmapRef * | GetBitmapRef (char *name) |
Return the BitmapRef matching the name parameter, possibly creating the VarEntry (variable) for it. | |
static BitmapArray * | GetBitmapArrayFromVar (VarEntry *var, bool allow_empty) |
Return the BitmapArray from a bitmap array variable. | |
static BitmapArray * | GetBitmapArray (char *name, bool allow_empty) |
Return the BitmapArray matching the name parameter, possibly creating the (VarEntry) variable. | |
static BitmapHash * | GetBitmapHashFromVar (VarEntry *var, bool allow_empty) |
Return the BitmapHash from a bitmap hash variable. | |
static BitmapHash * | GetBitmapHash (char *name, bool allow_empty) |
Return the BitmapHash matching the name parameter, possibly creating the VarEntry (variable) for it. | |
static Int4Array * | GetInt4ArrayFromVar (VarEntry *var, bool allow_empty) |
Return the Int4Array from an Int4Array variable. | |
static Int4Array * | GetInt4Array (char *name, bool allow_empty) |
Return the Int4Array matching the name parameter, possibly creating the VarEntry (variable) for it. | |
const Pg_finfo_record * | pg_finfo_veil_share (void) |
Datum | veil_share (FunctionCallInfo fcinfo) |
veil_share(text) returns bool Define a shared variable returning true if the variable is already defined. | |
const Pg_finfo_record * | pg_finfo_veil_variables (void) |
Datum | veil_variables (FunctionCallInfo fcinfo) |
veil_variables() returns setof veil_variable_t Return a veil_variable_t record for each defined variable. | |
const Pg_finfo_record * | pg_finfo_veil_init_range (void) |
Datum | veil_init_range (FunctionCallInfo fcinfo) |
veil_init_range(text, int4, int4) returns int4 Initialise a Range variable, returning the number of elements in the range. | |
Datum | datum_from_range (int32 min, int32 max) |
Create a datum containing the values of a veil_range_t composite type. | |
const Pg_finfo_record * | pg_finfo_veil_range (void) |
Datum | veil_range (FunctionCallInfo fcinfo) |
veil_range(text) returns veil_range_t Return the range (as a SQL veil_range_t composite type) from the named variable. | |
const Pg_finfo_record * | pg_finfo_veil_init_bitmap (void) |
Datum | veil_init_bitmap (FunctionCallInfo fcinfo) |
veil_init_bitmap(text, text) returns bool Create or re-initialise a Bitmap, for dealing with a named range of values. | |
const Pg_finfo_record * | pg_finfo_veil_clear_bitmap (void) |
Datum | veil_clear_bitmap (FunctionCallInfo fcinfo) |
veil_clear_bitmap(text) returns bool Clear all bits in the specified Bitmap. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_setbit (void) |
Datum | veil_bitmap_setbit (FunctionCallInfo fcinfo) |
veil_bitmap_setbit(int4, text) returns bool Set the specified bit in the specified Bitmap. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_clearbit (void) |
Datum | veil_bitmap_clearbit (FunctionCallInfo fcinfo) |
veil_bitmap_clearbit(int4, text) returns bool Clear the specified bit in the specified Bitmap. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_testbit (void) |
Datum | veil_bitmap_testbit (FunctionCallInfo fcinfo) |
veil_bitmap_testbit(int4, text) returns bool Test the specified bit in the specified Bitmap, returning true if it is set. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_union (void) |
Datum | veil_bitmap_union (FunctionCallInfo fcinfo) |
veil_bitmap_union(text, text) returns bool Union the bitmap specified in parameter 1 with that in parameter 2, with the result in parameter 1. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_intersect (void) |
Datum | veil_bitmap_intersect (FunctionCallInfo fcinfo) |
veil_bitmap_intersect(text, text) returns bool Intersect the bitmap specified in parameter 1 with that in parameter 2, with the result in parameter 1. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_bits (void) |
Datum | veil_bitmap_bits (FunctionCallInfo fcinfo) |
veil_bitmap_bits(text) returns setof int4 Return the set of all bits set in the specified Bitmap or BitmapRef. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_range (void) |
Datum | veil_bitmap_range (FunctionCallInfo fcinfo) |
veil_bitmap_range(text) returns veil_range_t Return composite type giving the range of the specified Bitmap or BitmapRef. | |
const Pg_finfo_record * | pg_finfo_veil_init_bitmap_array (void) |
Datum | veil_init_bitmap_array (FunctionCallInfo fcinfo) |
veil_init_bitmap_array(text, text, text) returns bool Create or reset a BitmapArray. | |
const Pg_finfo_record * | pg_finfo_veil_clear_bitmap_array (void) |
Datum | veil_clear_bitmap_array (FunctionCallInfo fcinfo) |
veil_clear_bitmap_array(text) returns bool Clear the bits in an existing BitmapArray. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_from_array (void) |
Datum | veil_bitmap_from_array (FunctionCallInfo fcinfo) |
veil_bitmap_from_array(text, text, int4) returns text Place a reference to the specified Bitmap from a BitmapArray into the specified BitmapRef An error will be raised if any parameter is not of the correct type. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_array_testbit (void) |
Datum | veil_bitmap_array_testbit (FunctionCallInfo fcinfo) |
veil_bitmap_array_testbit(text, int4, int4) returns bool Test a specified bit within a BitmapArray | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_array_setbit (void) |
Datum | veil_bitmap_array_setbit (FunctionCallInfo fcinfo) |
veil_bitmap_array_setbit(text, int4, int4) returns bool Set a specified bit within a BitmapArray | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_array_clearbit (void) |
Datum | veil_bitmap_array_clearbit (FunctionCallInfo fcinfo) |
veil_bitmap_array_clearbit(text, int4, int4) returns bool Clear a specified bit within a BitmapArray | |
const Pg_finfo_record * | pg_finfo_veil_union_from_bitmap_array (void) |
Datum | veil_union_from_bitmap_array (FunctionCallInfo fcinfo) |
veil_union_from_bitmap_array(text, text, int4) returns bool Union a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the first parameter. | |
const Pg_finfo_record * | pg_finfo_veil_intersect_from_bitmap_array (void) |
Datum | veil_intersect_from_bitmap_array (FunctionCallInfo fcinfo) |
veil_intersect_from_bitmap_array(text, text, int4) returns bool Intersect a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the first parameter. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_array_bits (void) |
Datum | veil_bitmap_array_bits (FunctionCallInfo fcinfo) |
veil_bitmap_array_bits(text) returns setof int4 Return the set of all bits set in the specified Bitmap from the BitmapArray. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_array_arange (void) |
Datum | veil_bitmap_array_arange (FunctionCallInfo fcinfo) |
veil_bitmap_array_arange(text) returns veil_range_t Return composite type giving the range of the array part of the specified BitmapArray | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_array_brange (void) |
Datum | veil_bitmap_array_brange (FunctionCallInfo fcinfo) |
veil_bitmap_array_brange(text) returns veil_range_t Return composite type giving the range of every Bitmap within the BitmapArray. | |
const Pg_finfo_record * | pg_finfo_veil_init_bitmap_hash (void) |
Datum | veil_init_bitmap_hash (FunctionCallInfo fcinfo) |
veil_init_bitmap_hash(text, text) returns bool Create or reset a BitmapHash. | |
const Pg_finfo_record * | pg_finfo_veil_clear_bitmap_hash (void) |
Datum | veil_clear_bitmap_hash (FunctionCallInfo fcinfo) |
veil_clear_bitmap_hash(text) returns bool Clear the bits in an existing BitmapHash. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_from_hash (void) |
Datum | veil_bitmap_from_hash (FunctionCallInfo fcinfo) |
veil_bitmap_from_hash(text, text, text) returns text Place a reference to the specified Bitmap from a BitmapHash into the specified BitmapRef An error will be raised if any parameter is not of the correct type. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_hash_testbit (void) |
Datum | veil_bitmap_hash_testbit (FunctionCallInfo fcinfo) |
veil_bitmap_hash_testbit(text, text, int4) returns bool Test a specified bit within a BitmapHash | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_hash_setbit (void) |
Datum | veil_bitmap_hash_setbit (FunctionCallInfo fcinfo) |
veil_bitmap_hash_setbit(text, text, int4) returns bool Set a specified bit within a BitmapHash | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_hash_clearbit (void) |
Datum | veil_bitmap_hash_clearbit (FunctionCallInfo fcinfo) |
veil_bitmap_hash_clearbit(text, text, int4) returns bool Clear a specified bit within a BitmapHash | |
const Pg_finfo_record * | pg_finfo_veil_union_into_bitmap_hash (void) |
Datum | veil_union_into_bitmap_hash (FunctionCallInfo fcinfo) |
veil_union_into_bitmap_hash(text, text, text) returns bool Union a Bitmap with the specified Bitmap from a BitmapHash with the result placed into the bitmap hash. | |
const Pg_finfo_record * | pg_finfo_veil_union_from_bitmap_hash (void) |
Datum | veil_union_from_bitmap_hash (FunctionCallInfo fcinfo) |
veil_union_from_bitmap_hash(text, text, text) returns bool Union a Bitmap with the specified Bitmap from a BitmapHash with the result placed into the bitmap parameter. | |
const Pg_finfo_record * | pg_finfo_veil_intersect_from_bitmap_hash (void) |
Datum | veil_intersect_from_bitmap_hash (FunctionCallInfo fcinfo) |
veil_intersect_from_bitmap_hash(text, text, text) returns bool Intersect a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the bitmap parameter. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_hash_bits (void) |
Datum | veil_bitmap_hash_bits (FunctionCallInfo fcinfo) |
veil_bitmap_hash_bits(text) returns setof int4 Return the set of all bits set in the specified Bitmap from the BitmapHash. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_hash_range (void) |
Datum | veil_bitmap_hash_range (FunctionCallInfo fcinfo) |
veil_bitmap_hash_range(text) returns veil_range_t Return composite type giving the range of every Bitmap within the BitmapHash. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_hash_entries (void) |
Datum | veil_bitmap_hash_entries (FunctionCallInfo fcinfo) |
veil_bitmap_hash_entries(text) returns setof text Return the key of every Bitmap within the BitmapHash. | |
const Pg_finfo_record * | pg_finfo_veil_bitmap_hash_defined (void) |
Datum | veil_bitmap_hash_defined (FunctionCallInfo fcinfo) |
veil_bitmap_hash_defined(text, text) returns bool Return true if the key exists in the bitmap hash. | |
const Pg_finfo_record * | pg_finfo_veil_int4_set (void) |
Datum | veil_int4_set (FunctionCallInfo fcinfo) |
veil_int4_set(text, int4) returns int4 Set an Int4Var variable type to a specified value. | |
const Pg_finfo_record * | pg_finfo_veil_int4_get (void) |
Datum | veil_int4_get (FunctionCallInfo fcinfo) |
veil_int4_get(text) returns int4 Return the value of an Int4Var variable. | |
const Pg_finfo_record * | pg_finfo_veil_init_int4array (void) |
Datum | veil_init_int4array (FunctionCallInfo fcinfo) |
veil_init_int4array(text, text) returns bool Initialise an Int4Array variable. | |
const Pg_finfo_record * | pg_finfo_veil_clear_int4array (void) |
Datum | veil_clear_int4array (FunctionCallInfo fcinfo) |
veil_clear_int4array(text) returns bool Clear an Int4Array variable. | |
const Pg_finfo_record * | pg_finfo_veil_int4array_set (void) |
Datum | veil_int4array_set (FunctionCallInfo fcinfo) |
veil_int4array_set(text, int4, int4) returns int4 Set an Int4Array entry. | |
const Pg_finfo_record * | pg_finfo_veil_int4array_get (void) |
Datum | veil_int4array_get (FunctionCallInfo fcinfo) |
veil_int4array_get(text, int4) returns int4 Get an Int4Array entry. | |
const Pg_finfo_record * | pg_finfo_veil_init (void) |
Datum | veil_init (FunctionCallInfo fcinfo) |
veil_init(bool) returns bool Initialise or reset a veil session. | |
const Pg_finfo_record * | pg_finfo_veil_perform_reset (void) |
Datum | veil_perform_reset (FunctionCallInfo fcinfo) |
veil_perform_reset() returns bool Reset veil shared memory for this database. | |
const Pg_finfo_record * | pg_finfo_veil_force_reset (void) |
Datum | veil_force_reset (FunctionCallInfo fcinfo) |
veil_force_reset() returns bool Reset veil shared memory for this database, ignoring existing transactions. | |
const Pg_finfo_record * | pg_finfo_veil_version (void) |
Datum | veil_version (FunctionCallInfo fcinfo) |
veil_version() returns text Return a string describing this version of veil. | |
Variables | |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
int | no_such_variable |
static char* strfromtext | ( | text * | in | ) | [static] |
Create a dynamically allocated C string as a copy of a text value.
in | text value from which the copy is made. |
Definition at line 39 of file veil_interface.c.
Referenced by pg_finfo_veil_bitmap_array_arange(), pg_finfo_veil_bitmap_from_hash(), pg_finfo_veil_intersect_from_bitmap_hash(), pg_finfo_veil_union_from_bitmap_hash(), pg_finfo_veil_union_into_bitmap_hash(), veil_bitmap_array_bits(), veil_bitmap_bits(), and veil_bitmap_hash_bits().
static text* textfromstr | ( | char * | in | ) | [static] |
Create a dynamically allocated text value as a copy of a C string.
in | String to be copied |
Definition at line 55 of file veil_interface.c.
static text* textfromstrn | ( | char * | in, | |
int | limit | |||
) | [static] |
Create a dynamically allocated text value as a copy of a C string, applying a limit to the length.
in | String to be copied | |
limit | Maximum length of string to be copied. |
Definition at line 74 of file veil_interface.c.
static char* copystr | ( | char * | str | ) | [static] |
Create a dynamically allocated text value as a copy of a C string, applying a limit to the length.
str | String to be copied |
Definition at line 98 of file veil_interface.c.
static char* strfromint | ( | int4 | val | ) | [static] |
Create a dynamically allocated C string as a copy of an integer value.
val | value to be stringified |
Definition at line 112 of file veil_interface.c.
static char* strfrombool | ( | bool | val | ) | [static] |
Create a dynamically allocated C string as a copy of a boolean value.
val | value to be stringified |
Definition at line 127 of file veil_interface.c.
static void ensure_init | ( | ) | [static] |
Perform session initialisation once for the session.
This calls the user-defined function veil_init which should create and possibly initialise all session and, maybe, shared variables. This function may be safely called any number of times - it will only perform the initialisation on the first call.
Definition at line 148 of file veil_interface.c.
References vl_bool_from_query(), vl_get_shared_hash(), vl_spi_connect(), and vl_spi_finish().
Referenced by pg_finfo_veil_bitmap_array_arange(), pg_finfo_veil_bitmap_array_clearbit(), pg_finfo_veil_bitmap_hash_entries(), pg_finfo_veil_bitmap_range(), pg_finfo_veil_clear_bitmap_array(), pg_finfo_veil_intersect_from_bitmap_array(), pg_finfo_veil_intersect_from_bitmap_hash(), pg_finfo_veil_share(), pg_finfo_veil_union_from_bitmap_array(), pg_finfo_veil_union_from_bitmap_hash(), pg_finfo_veil_union_into_bitmap_hash(), veil_bitmap_array_bits(), veil_bitmap_bits(), veil_bitmap_hash_bits(), and veil_variables().
Here is the call graph for this function:
Report, by raising an error, a type mismatch between the expected and actual type of a VarEntry variable.
name | The name of the variable | |
expected | The expected type. | |
got | The actual type |
Definition at line 197 of file veil_interface.c.
References vl_ObjTypeName().
Referenced by GetBitmapArrayFromVar(), GetBitmapFromVar(), GetBitmapHashFromVar(), GetBitmapRefFromVar(), and GetInt4ArrayFromVar().
Here is the call graph for this function:
static Int4Var* GetInt4Var | ( | char * | name, | |
bool | create | |||
) | [static] |
Return the Int4Var variable matching the name parameter, possibly creating the variable.
Raise an error if the named variable already exists and is of the wrong type.
name | The name of the variable. | |
create | Whether to create the variable if it does not exist. |
Definition at line 220 of file veil_interface.c.
static Range* GetRange | ( | char * | name, | |
bool | create | |||
) | [static] |
Return the Range variable matching the name parameter, possibly creating the variable.
Raise an error if the named variable already exists and is of the wrong type.
name | The name of the variable. | |
create | Whether to create the variable if it does not exist. |
Definition at line 257 of file veil_interface.c.
Return the Bitmap from a bitmap variable.
This function exists primarily to perform type checking, and to raise an error if the variable is not a bitmap.
var | The VarEntry that should contain a bitmap. | |
allow_empty | Whether to raise an error if the variable has not yet been initialised. | |
allow_ref | Whether to (not) raise an error if the variable is a bitmap_ref rather than a bitmap. |
Definition at line 297 of file veil_interface.c.
References BitmapRef::bitmap, VarEntry::key, OBJ_BITMAP, OBJ_BITMAP_REF, Bitmap::type, type_mismatch(), and BitmapRef::xid.
Here is the call graph for this function:
static Bitmap* GetBitmap | ( | char * | name, | |
bool | allow_empty, | |||
bool | allow_ref | |||
) | [static] |
Return the Bitmap matching the name parameter, possibly creating the VarEntry (variable) for it.
Raise an error if the named variable already exists and is of the wrong type.
name | The name of the variable. | |
allow_empty | Whether to raise an error if the variable has not been defined. | |
allow_ref | Whether to (not) raise an error if the variable is a bitmap_ref rather than a bitmap. |
Definition at line 348 of file veil_interface.c.
Referenced by veil_bitmap_bits().
Return the BitmapRef from a bitmap ref variable.
This function exists primarily to perform type checking, and to raise an error if the variable is not a bitmap ref. Note that BitmapRef variables may not be shared as they can contain references to non-shared objects.
var | The VarEntry that should contain a bitmap ref. |
Definition at line 371 of file veil_interface.c.
References VarEntry::key, OBJ_BITMAP_REF, BitmapRef::type, and type_mismatch().
Here is the call graph for this function:
static BitmapRef* GetBitmapRef | ( | char * | name | ) | [static] |
Return the BitmapRef matching the name parameter, possibly creating the VarEntry (variable) for it.
Raise an error if the named variable already exists and is of the wrong type.
name | The name of the variable. |
Definition at line 409 of file veil_interface.c.
Referenced by pg_finfo_veil_bitmap_from_hash().
static BitmapArray* GetBitmapArrayFromVar | ( | VarEntry * | var, | |
bool | allow_empty | |||
) | [static] |
Return the BitmapArray from a bitmap array variable.
This function exists primarily to perform type checking, and to raise an error if the variable is not a bitmap array.
var | The VarEntry that should contain a bitmap array. | |
allow_empty | Whether to raise an error if the variable has not yet been initialised. |
Definition at line 432 of file veil_interface.c.
References VarEntry::key, OBJ_BITMAP_ARRAY, BitmapArray::type, and type_mismatch().
Here is the call graph for this function:
static BitmapArray* GetBitmapArray | ( | char * | name, | |
bool | allow_empty | |||
) | [static] |
Return the BitmapArray matching the name parameter, possibly creating the (VarEntry) variable.
Raise an error if the named variable already exists and is of the wrong type.
name | The name of the variable. | |
allow_empty | Whether to raise an error if the variable has not been defined |
Definition at line 464 of file veil_interface.c.
Referenced by pg_finfo_veil_bitmap_array_arange(), and veil_bitmap_array_bits().
static BitmapHash* GetBitmapHashFromVar | ( | VarEntry * | var, | |
bool | allow_empty | |||
) | [static] |
Return the BitmapHash from a bitmap hash variable.
This function exists primarily to perform type checking, and to raise an error if the variable is not a bitmap hash.
var | The VarEntry that should contain a bitmap hash. | |
allow_empty | Whether to raise an error if the variable has not yet been initialised. |
Definition at line 488 of file veil_interface.c.
References VarEntry::key, OBJ_BITMAP_HASH, BitmapHash::type, and type_mismatch().
Here is the call graph for this function:
static BitmapHash* GetBitmapHash | ( | char * | name, | |
bool | allow_empty | |||
) | [static] |
Return the BitmapHash matching the name parameter, possibly creating the VarEntry (variable) for it.
Raise an error if the named variable already exists and is of the wrong type.
name | The name of the variable. | |
allow_empty | Whether to raise an error if the variable has not been defined. |
Definition at line 520 of file veil_interface.c.
Referenced by veil_bitmap_hash_bits().
Return the Int4Array from an Int4Array variable.
This function exists primarily to perform type checking, and to raise an error if the variable is not an Int4Array.
var | The VarEntry that should contain an Int4Array. | |
allow_empty | Whether to raise an error if the variable has not yet been initialised. |
Definition at line 544 of file veil_interface.c.
References VarEntry::key, OBJ_INT4_ARRAY, Int4Array::type, and type_mismatch().
Here is the call graph for this function:
static Int4Array* GetInt4Array | ( | char * | name, | |
bool | allow_empty | |||
) | [static] |
Return the Int4Array matching the name parameter, possibly creating the VarEntry (variable) for it.
Raise an error if the named variable already exists and is of the wrong type.
name | The name of the variable. | |
allow_empty | Whether to raise an error if the variable has not been defined. |
Definition at line 576 of file veil_interface.c.
Datum veil_share | ( | FunctionCallInfo | fcinfo | ) |
veil_share(text) returns bool
Define a shared variable returning true if the variable is already defined.
If the variable is already defined as a session variable an ERROR will be raised.
Session variables are simply defined by their first usage. Shared variables must be defined using this function. They may then be used in exactly the same way as session variables. Shared variables are shared by all backends and so need only be initialised once. The result of this function tells the caller whether the variable needs to be initialised. The caller that first defines a shared variable will get a false result and from this will know that the variable must be initialised. All subsequent callers will get a true result and so will know that the variable is already initialised.
fcinfo | text name of variable. |
bool
true if the variable already exists Definition at line 609 of file veil_interface.c.
Datum veil_variables | ( | FunctionCallInfo | fcinfo | ) |
veil_variables() returns setof veil_variable_t
Return a veil_variable_t
record for each defined variable.
This includes both session and shared variables.
fcinfo | None |
setof veil_variable_t
Definition at line 632 of file veil_interface.c.
References ensure_init().
Here is the call graph for this function:
Datum veil_init_range | ( | FunctionCallInfo | fcinfo | ) |
veil_init_range(text, int4, int4) returns int4 Initialise a Range variable, returning the number of elements in the range.
Ranges contain a min value and a max value. They may be examined using the veil_range() function.
fcinfo | text The name of the variable to initialise. int4 The min value of the range. int4 The max value of the range. |
int4
The size of the range ((max - min) + 1). Definition at line 701 of file veil_interface.c.
Datum datum_from_range | ( | int32 | min, | |
int32 | max | |||
) |
Create a datum containing the values of a veil_range_t composite type.
min | Min value of range | |
max | Max value of range |
Definition at line 730 of file veil_interface.c.
Datum veil_range | ( | FunctionCallInfo | fcinfo | ) |
veil_range(text) returns veil_range_t
Return the range (as a SQL veil_range_t composite type) from the named variable.
An Error will be raised if the variable is not defined or is of the wrong type.
fcinfo | text The name of the range variable. |
veil_range_t
Composite type containing the min and max values from the named variable. Definition at line 778 of file veil_interface.c.
Datum veil_init_bitmap | ( | FunctionCallInfo | fcinfo | ) |
veil_init_bitmap(text, text) returns bool
Create or re-initialise a Bitmap, for dealing with a named range of values.
An error will be raised if the variable already exists and is not a Bitmap.
fcinfo | text The name of the bitmap to create or reset text The name of a Range variable that defines the range of the new bitmap. |
bool
true Definition at line 809 of file veil_interface.c.
Datum veil_clear_bitmap | ( | FunctionCallInfo | fcinfo | ) |
veil_clear_bitmap(text) returns bool
Clear all bits in the specified Bitmap.
An error will be raised if the variable is not a Bitmap or BitmapRef.
fcinfo | text The name of the bitmap to be cleared. |
bool
true Definition at line 843 of file veil_interface.c.
Datum veil_bitmap_setbit | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_setbit(int4, text) returns bool
Set the specified bit in the specified Bitmap.
An error will be raised if the variable is not a Bitmap or BitmapRef.
fcinfo | int4 The bit to be set text The name of the bitmap variable. |
bool
true Definition at line 872 of file veil_interface.c.
Datum veil_bitmap_clearbit | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_clearbit(int4, text) returns bool
Clear the specified bit in the specified Bitmap.
An error will be raised if the variable is not a Bitmap or BitmapRef.
fcinfo | int4 The bit to be cleared text The name of the bitmap variable. |
bool
true Definition at line 900 of file veil_interface.c.
Datum veil_bitmap_testbit | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_testbit(int4, text) returns bool
Test the specified bit in the specified Bitmap, returning true if it is set.
An error will be raised if the variable is not a Bitmap or BitmapRef.
fcinfo | int4 The bit to be tested. text The name of the bitmap variable. |
bool
true if the bit was set Definition at line 929 of file veil_interface.c.
Datum veil_bitmap_union | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_union(text, text) returns bool
Union the bitmap specified in parameter 1 with that in parameter 2, with the result in parameter 1.
An error will be raised if the variables are not of type Bitmap or BitmapRef.
fcinfo | text The target bitmap text The bitmap with which to union the target |
bool
true Definition at line 961 of file veil_interface.c.
Datum veil_bitmap_intersect | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_intersect(text, text) returns bool
Intersect the bitmap specified in parameter 1 with that in parameter 2, with the result in parameter 1.
An error will be raised if the variables are not of type Bitmap or BitmapRef.
fcinfo | text The target bitmap text The bitmap with which to intersect the target |
bool
true Definition at line 995 of file veil_interface.c.
Datum veil_bitmap_bits | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_bits(text)
returns setof int4 Return the set of all bits set in the specified Bitmap or BitmapRef.
fcinfo | text The name of the bitmap. |
setof int4
The set of bits that are set in the bitmap. Definition at line 1024 of file veil_interface.c.
References ensure_init(), GetBitmap(), and strfromtext().
Here is the call graph for this function:
Datum veil_bitmap_range | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_range(text) returns veil_range_t
Return composite type giving the range of the specified Bitmap or BitmapRef.
fcinfo | text The name of the bitmap. |
veil_range_t
Composite type containing the min and max values of the bitmap's range Definition at line 1090 of file veil_interface.c.
Datum veil_init_bitmap_array | ( | FunctionCallInfo | fcinfo | ) |
veil_init_bitmap_array(text, text, text) returns bool
Create or reset a BitmapArray.
An error will be raised if any parameter is not of the correct type.
fcinfo | text The name of the bitmap array. text Name of the Range variable that provides the range of the array part of the bitmap array. text Name of the Range variable that provides the range of each bitmap in the array. |
bool
True Definition at line 1128 of file veil_interface.c.
Datum veil_clear_bitmap_array | ( | FunctionCallInfo | fcinfo | ) |
veil_clear_bitmap_array(text) returns bool
Clear the bits in an existing BitmapArray.
An error will be raised if the parameter is not of the correct type.
fcinfo | text The name of the BitmapArray. |
bool
True Definition at line 1168 of file veil_interface.c.
Datum veil_bitmap_from_array | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_from_array(text, text, int4) returns text
Place a reference to the specified Bitmap from a BitmapArray into the specified BitmapRef An error will be raised if any parameter is not of the correct type.
fcinfo | text The name of the BitmapRef into which a reference to the relevant Bitmap will be placed. text Name of the BitmapArray containing the Bitmap in which we are interested. int4 Index into the array of the bitmap in question. |
text
The name of the BitmapRef Definition at line 1200 of file veil_interface.c.
Datum veil_bitmap_array_testbit | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_array_testbit(text, int4, int4) returns bool
Test a specified bit within a BitmapArray
An error will be raised if the first parameter is not a BitmapArray.
fcinfo | text The name of the BitmapArray int4 Index of the Bitmap within the array. int4 Bit id of the bit within the Bitmap. |
bool
True if the bit was set, false otherwise. Definition at line 1239 of file veil_interface.c.
Datum veil_bitmap_array_setbit | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_array_setbit(text, int4, int4) returns bool
Set a specified bit within a BitmapArray
An error will be raised if the first parameter is not a BitmapArray.
fcinfo | text The name of the BitmapArray int4 Index of the Bitmap within the array. int4 Bit id of the bit within the Bitmap. |
bool
True Definition at line 1278 of file veil_interface.c.
Datum veil_bitmap_array_clearbit | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_array_clearbit(text, int4, int4) returns bool
Clear a specified bit within a BitmapArray
An error will be raised if the first parameter is not a BitmapArray.
fcinfo | text The name of the BitmapArray int4 Index of the Bitmap within the array. int4 Bit id of the bit within the Bitmap. |
bool
True Definition at line 1323 of file veil_interface.c.
Datum veil_union_from_bitmap_array | ( | FunctionCallInfo | fcinfo | ) |
veil_union_from_bitmap_array(text, text, int4) returns bool
Union a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the first parameter.
An error will be raised if the parameters are not of the correct types.
fcinfo | text The name of the Bitmap into which the resulting union will be placed. text Name of the BitmapArray int4 Index of the required bitmap in the array |
bool
True Definition at line 1370 of file veil_interface.c.
Datum veil_intersect_from_bitmap_array | ( | FunctionCallInfo | fcinfo | ) |
veil_intersect_from_bitmap_array(text, text, int4) returns bool
Intersect a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the first parameter.
An error will be raised if the parameters are not of the correct types.
fcinfo | text The name of the Bitmap into which the resulting intersection will be placed. text Name of the BitmapArray int4 Index of the required bitmap in the array |
bool
True Definition at line 1411 of file veil_interface.c.
Datum veil_bitmap_array_bits | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_array_bits(text)
returns setof int4 Return the set of all bits set in the specified Bitmap from the BitmapArray.
fcinfo | text The name of the bitmap array. int4 Index of the required bitmap in the array |
setof int4
The set of bits that are set in the bitmap. Definition at line 1449 of file veil_interface.c.
References BitmapArray::arraymax, BitmapArray::arrayzero, ensure_init(), GetBitmapArray(), strfromtext(), and vl_BitmapFromArray().
Here is the call graph for this function:
Datum veil_bitmap_array_arange | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_array_arange(text) returns veil_range_t
Return composite type giving the range of the array part of the specified BitmapArray
fcinfo | text The name of the bitmap array. |
veil_range_t
Composite type containing the min and max indices of the array Definition at line 1530 of file veil_interface.c.
Datum veil_bitmap_array_brange | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_array_brange(text) returns veil_range_t
Return composite type giving the range of every Bitmap within the BitmapArray.
fcinfo | text The name of the bitmap array. |
veil_range_t
Composite type containing the min and max values of the bitmap array's range Definition at line 1565 of file veil_interface.c.
Datum veil_init_bitmap_hash | ( | FunctionCallInfo | fcinfo | ) |
veil_init_bitmap_hash(text, text) returns bool
Create or reset a BitmapHash.
An error will be raised if any parameter is not of the correct type.
fcinfo | text The name of the bitmap hash. text Name of the Range variable that provides the range of each bitmap in the hash. |
bool
True Definition at line 1602 of file veil_interface.c.
Datum veil_clear_bitmap_hash | ( | FunctionCallInfo | fcinfo | ) |
veil_clear_bitmap_hash(text) returns bool
Clear the bits in an existing BitmapHash.
An error will be raised if the parameter is not of the correct type.
fcinfo | text The name of the BitmapHash. |
bool
True Definition at line 1647 of file veil_interface.c.
Datum veil_bitmap_from_hash | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_from_hash(text, text, text) returns text
Place a reference to the specified Bitmap from a BitmapHash into the specified BitmapRef An error will be raised if any parameter is not of the correct type.
fcinfo | text The name of the BitmapRef into which a reference to the relevant Bitmap will be placed. text Name of the BitmapHash containing the Bitmap in which we are interested. text Key, into the hash, of the bitmap in question. |
text
The name of the BitmapRef Definition at line 1683 of file veil_interface.c.
Datum veil_bitmap_hash_testbit | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_hash_testbit(text, text, int4) returns bool
Test a specified bit within a BitmapHash
An error will be raised if the first parameter is not a BitmapHash.
fcinfo | text The name of the BitmapHash text Key of the Bitmap within the hash. int4 Bit id of the bit within the Bitmap. |
bool
True if the bit was set, false otherwise. Definition at line 1722 of file veil_interface.c.
Datum veil_bitmap_hash_setbit | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_hash_setbit(text, text, int4) returns bool
Set a specified bit within a BitmapHash
An error will be raised if the first parameter is not a BitmapHash.
fcinfo | text The name of the BitmapHash text Key of the Bitmap within the hash. int4 Bit id of the bit within the Bitmap. |
bool
True Definition at line 1760 of file veil_interface.c.
Datum veil_bitmap_hash_clearbit | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_hash_clearbit(text, text, int4) returns bool
Clear a specified bit within a BitmapHash
An error will be raised if the first parameter is not a BitmapHash.
fcinfo | text The name of the BitmapHash text Key of the Bitmap within the hash. int4 Bit id of the bit within the Bitmap. |
bool
True Definition at line 1795 of file veil_interface.c.
Datum veil_union_into_bitmap_hash | ( | FunctionCallInfo | fcinfo | ) |
veil_union_into_bitmap_hash(text, text, text) returns bool
Union a Bitmap with the specified Bitmap from a BitmapHash with the result placed into the bitmap hash.
An error will be raised if the parameters are not of the correct types.
fcinfo | text Name of the BitmapHash text Key of the required bitmap in the hash text The name of the Bitmap into which the resulting union will be placed. |
bool
True Definition at line 1832 of file veil_interface.c.
Datum veil_union_from_bitmap_hash | ( | FunctionCallInfo | fcinfo | ) |
veil_union_from_bitmap_hash(text, text, text) returns bool
Union a Bitmap with the specified Bitmap from a BitmapHash with the result placed into the bitmap parameter.
An error will be raised if the parameters are not of the correct types.
fcinfo | text The name of the Bitmap into which the resulting union will be placed. text Name of the BitmapHash text Key of the required bitmap in the hash |
bool
True Definition at line 1872 of file veil_interface.c.
Datum veil_intersect_from_bitmap_hash | ( | FunctionCallInfo | fcinfo | ) |
veil_intersect_from_bitmap_hash(text, text, text) returns bool
Intersect a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the bitmap parameter.
An error will be raised if the parameters are not of the correct types.
fcinfo | text The name of the Bitmap into which the resulting intersection will be placed. text Name of the BitmapHash text Key of the required bitmap in the hash |
bool
True Definition at line 1912 of file veil_interface.c.
Datum veil_bitmap_hash_bits | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_hash_bits(text)
returns setof int4 Return the set of all bits set in the specified Bitmap from the BitmapHash.
fcinfo | text The name of the bitmap hash. text Key of the required bitmap in the hash |
setof int4
The set of bits that are set in the bitmap. Definition at line 1954 of file veil_interface.c.
References ensure_init(), GetBitmapHash(), strfromtext(), and vl_BitmapFromHash().
Here is the call graph for this function:
Datum veil_bitmap_hash_range | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_hash_range(text) returns veil_range_t
Return composite type giving the range of every Bitmap within the BitmapHash.
fcinfo | text The name of the bitmap array. |
veil_range_t
Composite type containing the min and max values of the bitmap hash's range Definition at line 2025 of file veil_interface.c.
Datum veil_bitmap_hash_entries | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_hash_entries(text) returns setof text
Return the key of every Bitmap within the BitmapHash.
fcinfo | text The name of the bitmap hash. |
setof text
Every key in the hash. Definition at line 2055 of file veil_interface.c.
Datum veil_bitmap_hash_defined | ( | FunctionCallInfo | fcinfo | ) |
veil_bitmap_hash_defined(text, text) returns bool
Return true if the key exists in the bitmap hash.
fcinfo | text The name of the bitmap hash. text Key of the required bitmap in the hash |
bool
True if key is defined in the hash Definition at line 2118 of file veil_interface.c.
Datum veil_int4_set | ( | FunctionCallInfo | fcinfo | ) |
veil_int4_set(text, int4) returns int4
Set an Int4Var variable type to a specified value.
An Error will be raised if the variable is not defined or is of the wrong type.
fcinfo | text The name of the int4 variable. | |
fcinfo | int4 The value to be set (may be null). |
int4
The new value of the variable. Definition at line 2149 of file veil_interface.c.
Datum veil_int4_get | ( | FunctionCallInfo | fcinfo | ) |
veil_int4_get(text) returns int4
Return the value of an Int4Var variable.
An Error will be raised if the variable is not defined or is of the wrong type.
fcinfo | text The name of the int4 variable. |
int4
The value of the variable. Definition at line 2183 of file veil_interface.c.
Datum veil_init_int4array | ( | FunctionCallInfo | fcinfo | ) |
veil_init_int4array(text, text) returns bool
Initialise an Int4Array variable.
Each entry in the array will be zeroed.
fcinfo | text The name of the Int4Array variable. text Name of the range variable defining the size of the array. |
bool
True Definition at line 2214 of file veil_interface.c.
Datum veil_clear_int4array | ( | FunctionCallInfo | fcinfo | ) |
veil_clear_int4array(text) returns bool
Clear an Int4Array variable.
Each entry in the array will be zeroed.
fcinfo | text The name of the Int4Array variable. |
bool
True Definition at line 2248 of file veil_interface.c.
Datum veil_int4array_set | ( | FunctionCallInfo | fcinfo | ) |
veil_int4array_set(text, int4, int4) returns int4
Set an Int4Array entry.
fcinfo | text The name of the Int4Array variable. int4 Index of the entry to be set int4 Value to which the entry will be set |
int4
The new value of the array entry Definition at line 2274 of file veil_interface.c.
Datum veil_int4array_get | ( | FunctionCallInfo | fcinfo | ) |
veil_int4array_get(text, int4) returns int4
Get an Int4Array entry.
fcinfo | text The name of the Int4Array variable. int4 Index of the entry to be retrieved |
int4
The value of the array entry Definition at line 2302 of file veil_interface.c.
Datum veil_init | ( | FunctionCallInfo | fcinfo | ) |
veil_init(bool) returns bool
Initialise or reset a veil session.
The boolean parameter will be false when called for initialisation, and true when performing a reset.
This function must be redefined as a custom function in your implementation.
fcinfo | bool Whether we are being called in order to reset (true) the session or (false) simply to initialise it. |
bool
True Definition at line 2335 of file veil_interface.c.
Datum veil_perform_reset | ( | FunctionCallInfo | fcinfo | ) |
veil_perform_reset() returns bool
Reset veil shared memory for this database.
This creates a new shared memory context with none of the existing shared variables. All current transactions will be able to continue using the current variables, all new transactions will see the new set, once this function has completed.
fcinfo |
bool
True if the function is able to complete successfully. If it is unable, no harm will have been done but neither will a memory reset have been performed. Definition at line 2361 of file veil_interface.c.
Datum veil_force_reset | ( | FunctionCallInfo | fcinfo | ) |
veil_force_reset() returns bool
Reset veil shared memory for this database, ignoring existing transactions.
This function will always reset the shared memory context, even for sessions that are still using it. Having taken this drastic action, it will then cause a panic to reset the server.
Question - won't a panic reset the shared memory in any case? Is the panic superfluous, or maybe is this entire function superfluous?
fcinfo |
bool
True. Definition at line 2416 of file veil_interface.c.
Datum veil_version | ( | FunctionCallInfo | fcinfo | ) |
veil_version() returns text
Return a string describing this version of veil.
fcinfo |
text
String describing the version. Definition at line 2433 of file veil_interface.c.