Author: Marc Munro
Copyright (c) 2005 - 2011 Marc Munro
License: BSD
Definition in file veil_variables.c.
#include "postgres.h"
#include "veil_datatypes.h"
#include "utils/hsearch.h"
#include "storage/shmem.h"
#include "veil_funcs.h"

Go to the source code of this file.
Defines | |
| #define | SESSION_HASH_ELEMS 32 |
| Baselines the number of session variables that can be created in each context. | |
Functions | |
| static HTAB * | create_session_hash () |
| Create, or attach to, a hash for session variables. | |
| VarEntry * | vl_lookup_shared_variable (char *name) |
| Define a new, or attach to an existing, shared variable. | |
| VarEntry * | vl_lookup_variable (char *name) |
| Lookup a variable by name, creating it as as a session variable if it does not already exist. | |
| veil_variable_t * | vl_next_variable (veil_variable_t *prev) |
| Return the next variable from a scan of the hash of variables. | |
| void | vl_ClearInt4Array (Int4Array *array) |
| Reset all Int4 entries in an Int4Array (to zero). | |
| Int4Array * | vl_NewInt4Array (Int4Array *current, bool shared, int32 min, int32 max) |
| Return a newly initialised (zeroed) Int4Array. | |
| void | vl_Int4ArraySet (Int4Array *array, int32 idx, int32 value) |
| Set an entry within an Int4Array. | |
| int32 | vl_Int4ArrayGet (Int4Array *array, int32 idx) |
| Get an entry from an Int4Array. | |
Variables | |
| static HTAB * | session_hash = ((void *) 0) |
| This identifies the hash table for all session variables. | |
| VarEntry* vl_lookup_shared_variable | ( | char * | name | ) |
Define a new, or attach to an existing, shared variable.
Raise an ERROR if the variable already exists as a session variable or if we cannot create the variable due to resource limitations (out of memory, or out of space in the shared hash).
| name | The name of the variable. |
Definition at line 70 of file veil_variables.c.
References create_session_hash(), VarEntry::obj, session_hash, VarEntry::shared, and vl_get_shared_hash().

| VarEntry* vl_lookup_variable | ( | char * | name | ) |
Lookup a variable by name, creating it as as a session variable if it does not already exist.
| name | The name of the variable |
Definition at line 124 of file veil_variables.c.
Referenced by deserialise_bitmap(), deserialise_bitmap_array(), deserialise_bitmap_hash(), deserialise_int4array(), deserialise_int4var(), deserialise_range(), veil_int4_get(), and vl_serialise_var().
| veil_variable_t* vl_next_variable | ( | veil_variable_t * | prev | ) |
Return the next variable from a scan of the hash of variables.
Note that this function is not re-entrant.
| prev | The last variable retrieved by a scan, or NULL if starting a new scan. |
Definition at line 170 of file veil_variables.c.
References create_session_hash(), and session_hash.

| void vl_ClearInt4Array | ( | Int4Array * | array | ) |
Reset all Int4 entries in an Int4Array (to zero).
| array | The array to be reset. |
Definition at line 227 of file veil_variables.c.
References Int4Array::array.
Referenced by vl_NewInt4Array().
Return a newly initialised (zeroed) Int4Array.
It may already exist in which case it will be re-used if possible. It may be created in either session or shared memory depending on the value of shared.
| current | Pointer to an existing Int4Array if one exists. | |
| shared | Whether to create the variable in shared or session memory. | |
| min | Index of the first entry in the array. | |
| max | Index of the last entry in the array. |
Definition at line 249 of file veil_variables.c.
References Int4Array::arraymax, Int4Array::arrayzero, and vl_ClearInt4Array().
Referenced by deserialise_int4array(), and veil_int4_get().

| void vl_Int4ArraySet | ( | Int4Array * | array, | |
| int32 | idx, | |||
| int32 | value | |||
| ) |
Set an entry within an Int4Array.
If idx is outside of the acceptable range, raise an error.
| array | The Int4Array within which the entry is to be set. | |
| idx | The index of the entry to be set. | |
| value | The value to which the entry will be set. |
Definition at line 293 of file veil_variables.c.
References Int4Array::arraymax, and Int4Array::arrayzero.
Referenced by veil_clear_int4array().
| int32 vl_Int4ArrayGet | ( | Int4Array * | array, | |
| int32 | idx | |||
| ) |
Get an entry from an Int4Array.
If idx is outside of the acceptable range, raise an error.
| array | The Int4Array within from the entry is to be read. | |
| idx | The index of the entry to be retrieved. |
Definition at line 318 of file veil_variables.c.
References Int4Array::arraymax, and Int4Array::arrayzero.
Referenced by veil_int4array_set().
HTAB* session_hash = ((void *) 0) [static] |
This identifies the hash table for all session variables.
The shared variable hash tables are managed in veil_shmem.c.
Definition at line 36 of file veil_variables.c.
Referenced by vl_lookup_shared_variable(), and vl_next_variable().
1.5.6