Variables

## Variables Variables — Variable with names and literal value. |

## Functions

rasqal_variable * | rasqal_new_variable_from_variable ()
void | rasqal_free_variable ()
int | rasqal_variable_print ()
void | rasqal_variable_set_value ()

## Types and Values

| rasqal_variable
enum | rasqal_variable_type

## Description

A class to hold a variable with optional name and a rasqal_literal value. The name is not required for SPARQL anonymous variables.

## Functions

### rasqal_new_variable_from_variable ()

    rasqal_variable *
    rasqal_new_variable_from_variable (rasqal_variable *v);

#### Returns

### rasqal_free_variable ()

    void
    rasqal_free_variable (rasqal_variable *v);

### rasqal_variable_print ()

    int
    rasqal_variable_print (rasqal_variable *v,
                           FILE *fh);

#### Returns

### rasqal_variable_set_value ()

    void
    rasqal_variable_set_value (rasqal_variable *v,
                               rasqal_literal *l);

## Types and Values

### rasqal_variable

    typedef struct {
      rasqal_variables_table* vars_table;
      const char * name;
      rasqal_literal* value;
      int offset;
      rasqal_variable_type type;
      struct rasqal_expression_s* expression;
      void *user_data;
      int usage;
    } rasqal_variable;

Binding between a variable name and a value.

Includes internal field `offset` for recording the offset into the (internal) rasqal_query variables array.

#### Members

rasqal_variables_table *`vars_table`; | variables table that owns this variable |
const char *`name`; | Variable name. |
rasqal_literal *`value`; | Variable value or NULL if unbound. |
int `offset`; | Internal. |
rasqal_variable_type `type`; | Variable type. |
struct rasqal_expression_s *`expression`; | Expression when the variable is a computed SELECT expression |
void *`user_data`; | Pointer to user data associated with a variable. This is not used by rasqal. |
int `usage`; | reference count |

### enum rasqal_variable_type

Rasqal variable types.

ANONYMOUS can be used in queries but cannot be returned in a result.

#### Members

RASQAL_VARIABLE_TYPE_UNKNOWN | Internal. |
RASQAL_VARIABLE_TYPE_NORMAL | The regular variable type. |
RASQAL_VARIABLE_TYPE_ANONYMOUS | Anonymous variable type. |