Logo Search packages:      
Sourcecode: dballe version File versions

dba_err dba_record_var_set ( dba_record  rec,
dba_varcode  code,
dba_var  var 

Set the value of a parameter, from a dba_var. If dba_var has a value for a different parameter, it will be converted.

rec The record where the value is to be set.
code The variable to set the value for.
var A the dba_var with the parameter which will be copied inside the record. The record will copy the variable and will not take ownership of it: memory management will remain in charge of the caller.
The error indicator for the function (
See also:

Definition at line 566 of file dba_record.c.

References DBA_RUN_OR_GOTO.


      dba_err err = DBA_OK;
      dba_item i = NULL;

      /* If var is undef, remove this variable from the record */
      if (dba_var_value(var) == NULL)
            dba_record_remove_item(rec, code);
            /* Lookup the variable in the hash table */
            DBA_RUN_OR_GOTO(fail1, dba_record_obtain_item(rec, code, &i));

            /* Set the value of the variable */
            if (i->var != NULL)
                  i->var = NULL;
            if (dba_var_code(var) == code)
                  DBA_RUN_OR_GOTO(fail1, dba_var_copy(var, &(i->var)));
                  dba_varinfo info;
                  DBA_RUN_OR_GOTO(fail1, dba_varinfo_query_local(code, &info));
                  DBA_RUN_OR_GOTO(fail1, dba_var_convert(var, info, &(i->var)));
      return dba_error_ok();
      if (i != NULL)
            dba_record_remove_dba_item(rec, i);
      return err;

Generated by  Doxygen 1.6.0   Back to index