Top | ![]() |
![]() |
![]() |
![]() |
rasqal_variables_table *
rasqal_new_variables_table (rasqal_world *world
);
Constructor - create a new variables table
void
rasqal_free_variables_table (rasqal_variables_table *vt
);
Destructor - destroy a new variables table
rasqal_variable * rasqal_variables_table_add (rasqal_variables_table *vt
,rasqal_variable_type type
,const char *name
,rasqal_literal *value
);
rasqal_variables_table_add
is deprecated and should not be used in newly-written code.
Constructor - Create a new variable and add it to the variables table
Deprecated
: for rasqal_variables_table_add2()
which copies the name
and value
The name
and value
become owned by the rasqal_variable
structure. If a variable with the name already exists, that is
returned and the new value
is ignored.
vt |
rasqal_variables_table to associate the variable with |
|
type |
variable type defined by enumeration rasqal_variable_type |
|
name |
variable name |
|
value |
variable rasqal_literal value (or NULL) |
rasqal_variable * rasqal_variables_table_add2 (rasqal_variables_table *vt
,rasqal_variable_type type
,const char *name
,size_t name_len
,rasqal_literal *value
);
Constructor - Create a new variable and add it to the variables table
The name
and value
fields are copied. If a variable with the
name already exists, that is returned and the new value
is
ignored.
vt |
rasqal_variables_table to associate the variable with |
|
type |
variable type defined by enumeration rasqal_variable_type |
|
name |
variable name |
|
name_len |
length of |
|
value |
variable rasqal_literal value (or NULL) |
int rasqal_variables_table_add_variable (rasqal_variables_table *vt
,rasqal_variable *variable
);
Constructor - Add an existing variable to the variables table
The variables table vt
takes a reference to variable
. This
function will fail if the variable is already in the table. Use
rasqal_variables_table_contains()
to check before calling.
vt |
rasqal_variables_table to associate the variable with |
|
variable |
existing variable to add |
rasqal_variable * rasqal_variables_table_get_by_name (rasqal_variables_table *vt
,rasqal_variable_type type
,const char *name
);
Lookup a variable by type and name in the variables table.
Note that looking up for any type RASQAL_VARIABLE_TYPE_UNKNOWN may a name match but for any type so in cases where the query has both a named and anonymous (extensional) variable, an arbitrary one will be returned.
vt |
the variables table |
|
type |
the variable type to match or RASQAL_VARIABLE_TYPE_UNKNOWN for any. |
|
name |
the variable type |
int rasqal_variables_table_contains (rasqal_variables_table *vt
,rasqal_variable_type type
,const char *name
);
Check if there is a variable with the given type and name in the variables table