Beispiel #1
0
/*
 * orp_oid_get_classname - 
 *    return:
 *    pool():
 *    xoid():
 *    name():
 *    size():
 */
static int
orp_oid_get_classname (API_OBJECT_RESULTSET_POOL * pool, CI_OID * xoid, char *name, size_t size)
{
  OBJECT_RESULTSET_POOL *p;
  OID oid;
  int res;
  void *r;
  DB_OBJECT *obj;

  assert (pool != NULL);
  assert (xoid != NULL);
  p = (OBJECT_RESULTSET_POOL *) pool;
  /* delete object resultset */
  xoid2oid (xoid, &oid);
  res = hash_lookup (p->ht, &oid, &r);
  if (res != NO_ERROR)
    return res;

  obj = ws_mop (&oid, NULL);
  if (obj)
    {
      char *tmp;
      tmp = (char *) db_get_class_name (obj);
      if (tmp)
	{
	  strncpy (name, tmp, size);
	  return NO_ERROR;
	}
    }

  strncpy (name, "NULL", size);

  return NO_ERROR;
}
Beispiel #2
0
static int
cursor_fetch_oids (CURSOR_ID * cursor_id_p, int oid_index,
		   DB_FETCH_MODE instant_fetch_mode,
		   DB_FETCH_MODE class_fetch_mode)
{
  int i;
  OID tmp_oid;
  MOBJ mobj;

  if (oid_index == 0)
    {
      /* nothing to fetch */
      return NO_ERROR;
    }

  /* form the MOP set from the existing oid_set */
  for (i = 0; i < oid_index; i++)
    {
      OR_GET_OID (&cursor_id_p->oid_set[i], &tmp_oid);
      cursor_id_p->mop_set[i] = ws_mop (&tmp_oid, (MOP) NULL);
    }


  if (oid_index == 1)
    {
      mobj = locator_fetch_object (cursor_id_p->mop_set[0],
				   instant_fetch_mode);
    }
  else
    {
      mobj = locator_fetch_set (oid_index, cursor_id_p->mop_set,
				instant_fetch_mode, class_fetch_mode, false);
    }

  if (mobj == NULL && er_errid () != ER_HEAP_UNKNOWN_OBJECT)
    {
      return ER_FAILED;
    }

  return NO_ERROR;
}