Exemple #1
0
static PyObject *set(BaseTDBResolver *self, PyObject *args, PyObject *kwds) {
  static char *kwlist[] = {"urn", "attribute", "value", NULL};
  TDB_DATA urn;
  TDB_DATA attribute;
  PyObject *value_obj, *value_str;
  TDB_DATA value;

  urn.dsize = 0;
  attribute.dsize = 0;
  if(!PyArg_ParseTupleAndKeywords(args, kwds, "s#s#O", kwlist, 
				  &urn.dptr, &urn.dsize, 
				  &attribute.dptr, &attribute.dsize,
				  &value_obj))
    return NULL;

  // Convert the object to a string
  value_str = PyObject_Str(value_obj);
  if(!value_str) return NULL;

  PyString_AsStringAndSize(value_str, (char **)&value.dptr, (int *)&value.dsize);

  /** If the value is already in the list, we just ignore this
      request.
  */
  if(is_value_present(self, urn, attribute, value, 1)) {
    goto exit;
  };

  set_new_value(self, urn, attribute, value);

 exit:
  Py_DECREF(value_str);
  Py_RETURN_NONE;
};
Exemple #2
0
/* A function to set a value in a column in the ACR */
static gboolean
set_value (gint col, GValue  *val, gpointer data)
{
  struct recode_dialog *rd = data;

  switch ( col )
    {
    case COL_VALUE_OLD:
      set_old_value (val, rd);
      break;
    case COL_VALUE_NEW:
      set_new_value (val, rd);
      break;
    default:
      return FALSE;
    }

  return TRUE;
}
Exemple #3
0
void
copy_values_region (struct rng *fm, struct rng *to)
{
  CELLREF rf, rt, cf, ct;
  union vals dummy;
  CELL *cpf;

  if (set_to_region (fm, to) < 1)
    return;

  for (rf = fm->lr, rt = to->lr; rt <= to->hr; rt++, rf++)
    {
      for (cf = fm->lc, ct = to->lc; ct <= to->hc; ct++, cf++)
	{
	  cpf = find_cell (rf, cf);
	  set_new_value (rt, ct, cpf ? GET_TYP (cpf) : 0, cpf ? &(cpf->c_z) : &dummy);

	  if (cf == fm->hc)
	    cf = fm->lc - 1;
	}
      if (rf == fm->hr)
	rf = fm->lr - 1;
    }
}
Exemple #4
0
 KS_RESULT  update_eval(KscServerBase* Server,
                        Dienst_param*  Params,
                        PltString&     out)
/*****************************************************************************/
{
    /*
    *        Variablen
    */
    char      help[256];
    PltString Str;
    KS_RESULT error;

///////////////////////////////////////////////////////////////////////////////
//  Dienst UnLink                                                            //
///////////////////////////////////////////////////////////////////////////////

    error = unlink_old_link(Server, Params, out);
    if(error) {
            return error;
    }

///////////////////////////////////////////////////////////////////////////////
//  Dienst DeleteObject                                                      //
///////////////////////////////////////////////////////////////////////////////

    error = delete_old_instance(Server, Params, out);
    if (error) {
            return error;
    }


///////////////////////////////////////////////////////////////////////////////
//  Alte Bibliotheken loeschen                                               //
///////////////////////////////////////////////////////////////////////////////

    DelInstItems* plib;
    plib = Params->OldLibs;
    while(plib) {
        sprintf(help, "/%s/%s", FB_LIBRARIES_CONTAINER, plib->Inst_name);
        Str = help;
        error = IFBS_DELETE_OBJ(Server, Str);
        if(error) {
            out += log_getErrMsg(error, "Library",plib->Inst_name,"couldn't be deleted.");
        } else {
            out += log_getOkMsg("Library",plib->Inst_name,"deleted.");
        }
        plib = plib->next;
    }

///////////////////////////////////////////////////////////////////////////////
//  Neue Instanzen anlegen                                                   //
///////////////////////////////////////////////////////////////////////////////

    error = import_eval(Server, Params, out, FALSE);
    if(error) {
        return error;
    }

///////////////////////////////////////////////////////////////////////////////
//  Dienst SetVar                                                            //
///////////////////////////////////////////////////////////////////////////////

    error = set_new_value(Server, Params, out);

    return error;
}