当前位置: 首页>>代码示例>>C++>>正文


C++ DB_ERROR函数代码示例

本文整理汇总了C++中DB_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ DB_ERROR函数的具体用法?C++ DB_ERROR怎么用?C++ DB_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DB_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ehgraph_transfer_info

bool ehgraph_transfer_info(ehgraph_t* dest, ehgraph_t* src, size_t lim) {
  bool bRet = false;

  do {

    CheckNotNULL(src);
    CheckNotNULL(dest);
    if (dest->ptrdim != src->ptrdim || dest->nLinks != src->nLinks) {
      DB_ERROR("graphs are not compatible");
      break;
    }

    if (lim > (src->size + src->ptrdim) || lim > (dest->size + dest->ptrdim)) {
      DB_ERROR("invalid arg");
      break;
    }

    size_t nL = src->nLinks;

    bRet = true;
    for (size_t i = 0; i < lim && bRet; ++i) 
      bRet = ehgraph_transfer_node_info(dest, i, src, i);
    
  } while(0);
  
  return bRet;
}
开发者ID:mihasighi,项目名称:celia-tools,代码行数:27,代码来源:ell_representation.c

示例2: unwrap

int DbChannel::send_request(Dbt *request, u_int32_t nrequest,
    Dbt *response, db_timeout_t timeout, u_int32_t flags)
{
	DB_CHANNEL *dbchannel = unwrap(this);
	DB_ENV *dbenv = unwrap(dbenv_);
	DBT *dbtlist;
	int i, ret;

	ret = __os_malloc(dbenv->env, sizeof(DBT) * nrequest, &dbtlist);
	if (ret != 0) {
		DB_ERROR(dbenv_, "DbChannel::send_request", ret,
		    ON_ERROR_UNKNOWN);
		return (ret);
	}

	for (i = 0; i < (int)nrequest; i++)
		memcpy(&dbtlist[i], request[i].get_DBT(), sizeof(DBT));

	if ((ret = dbchannel->send_request(dbchannel, dbtlist, nrequest,
	    response->get_DBT(), timeout, flags)) != 0)
		DB_ERROR(dbenv_, "DbChannel::send_request", ret,
		    ON_ERROR_UNKNOWN);

	__os_free(dbenv->env, dbtlist);

	return (ret);
}
开发者ID:Mayalinux,项目名称:db,代码行数:27,代码来源:cxx_channel.cpp

示例3: DB_ERROR

//static
int Db::_append_recno_intercept(DB *db, DBT *data, db_recno_t recno)
{
	int err;

	if (db == 0) {
		DB_ERROR("Db::append_recno_callback", EINVAL, ON_ERROR_UNKNOWN);
		return (EINVAL);
	}
	Db *cxxdb = (Db *)db->cj_internal;
	if (cxxdb == 0) {
		DB_ERROR("Db::append_recno_callback", EINVAL, ON_ERROR_UNKNOWN);
		return (EINVAL);
	}
	if (cxxdb->append_recno_callback_ == 0) {
		DB_ERROR("Db::append_recno_callback", EINVAL, cxxdb->error_policy());
		return (EINVAL);
	}

	// making these copies is slow but portable.
	// Another alternative is to cast the DBT* manufactured
	// by the C layer to a Dbt*.  It 'should be' safe since
	// Dbt is a thin shell over DBT, adding no extra data,
	// but is nonportable, and could lead to errors if anything
	// were added to the Dbt class.
	//
	Dbt cxxdbt;
	memcpy((DBT *)&cxxdbt, data, sizeof(DBT));
	err = (*cxxdb->append_recno_callback_)(cxxdb, &cxxdbt, recno);
	memcpy(data, (DBT *)&cxxdbt, sizeof(DBT));
	return (err);
}
开发者ID:NickeyWoo,项目名称:mysql-3.23.49,代码行数:32,代码来源:cxx_table.cpp

示例4: relation_load

relation_t *
relation_load(char *name)
{
  relation_t *rel;

  rel = relation_find(name);
  if(rel != NULL) {
    rel->references++;
    goto end;
  }

  rel = relation_allocate();
  if(rel == NULL) {
    return NULL;
  }

  if(DB_ERROR(storage_get_relation(rel, name))) {
    memb_free(&relations_memb, rel);
    return NULL;
  }

  memcpy(rel->name, name, sizeof(rel->name));
  rel->name[sizeof(rel->name) - 1] = '\0';
  rel->references = 1;
  list_add(relations, rel);

end:
  if(rel->dir == DB_STORAGE && DB_ERROR(storage_load(rel))) {
    relation_release(rel);
    return NULL;
  }

  return rel;
}
开发者ID:1uk3,项目名称:contiki,代码行数:34,代码来源:relation.c

示例5: relation_rename

db_result_t
relation_rename(char *old_name, char *new_name)
{
  if(DB_ERROR(relation_remove(new_name, 0)) ||
     DB_ERROR(storage_rename_relation(old_name, new_name))) {
    return DB_STORAGE_ERROR;
  }

  return DB_OK;
}
开发者ID:1uk3,项目名称:contiki,代码行数:10,代码来源:relation.c

示例6: unwrap

// If an error occurred during the constructor, report it now.
// Otherwise, call the underlying DB->open method.
//
int DbEnv::open(const char *db_home, u_int32_t flags, int mode)
{
	DB_ENV *env = unwrap(this);
	int err;

	if ((err = construct_error_) != 0)
		DB_ERROR("Db::open", err, error_policy());
	else if ((err = env->open(env, db_home, flags, mode)) != 0)
		DB_ERROR("DbEnv::open", err, error_policy());

	return (err);
}
开发者ID:NickeyWoo,项目名称:mysql-3.23.49,代码行数:15,代码来源:cxx_app.cpp

示例7: unwrap

// If an error occurred during the constructor, report it now.
// Otherwise, call the underlying DB->open method.
//
int Db::open(const char *file, const char *database,
	     DBTYPE type, u_int32_t flags, int mode)
{
	int err;
	DB *db = unwrap(this);

	if ((err = construct_error_) != 0)
		DB_ERROR("Db::open", construct_error_, error_policy());
	else if ((err = db->open(db, file, database, type, flags, mode)) != 0)
		DB_ERROR("Db::open", err, error_policy());

	return (err);
}
开发者ID:NickeyWoo,项目名称:mysql-3.23.49,代码行数:16,代码来源:cxx_table.cpp

示例8: DB_ERROR

void DbEnv::_paniccall_intercept(DB_ENV *env, int errval)
{
	if (env == 0) {
		DB_ERROR("DbEnv::paniccall_callback", EINVAL, ON_ERROR_UNKNOWN);
	}
	DbEnv *cxxenv = (DbEnv *)env->cj_internal;
	if (cxxenv == 0) {
		DB_ERROR("DbEnv::paniccall_callback", EINVAL, ON_ERROR_UNKNOWN);
	}
	if (cxxenv->paniccall_callback_ == 0) {
		DB_ERROR("DbEnv::paniccall_callback", EINVAL, cxxenv->error_policy());
	}
	(*cxxenv->paniccall_callback_)(cxxenv, errval);
}
开发者ID:NickeyWoo,项目名称:mysql-3.23.49,代码行数:14,代码来源:cxx_app.cpp

示例9: unwrap

int Db::sync(u_int32_t flags)
{
    DB *db = unwrap(this);
    if (!db) {
        DB_ERROR("Db::sync", EINVAL);
        return EINVAL;
    }
    int err;
    if ((err = db->sync(db, flags)) != 0) {
        DB_ERROR("Db::sync", err);
        return err;
    }
    return 0;
}
开发者ID:kenpeter,项目名称:htdig,代码行数:14,代码来源:cxx_table.cpp

示例10: relation_cardinality

tuple_id_t
relation_cardinality(relation_t *rel)
{
  tuple_id_t tuple_id;


  if(rel->cardinality != INVALID_TUPLE) {
    return rel->cardinality;
  }

  if(!RELATION_HAS_TUPLES(rel)) {
    return 0;
  }

  if(DB_ERROR(storage_get_row_amount(rel, &tuple_id))) {
    return INVALID_TUPLE;
  }

  rel->cardinality = tuple_id;

  PRINTF("DB: Relation %s has cardinality %lu\n", rel->name,
	(unsigned long)tuple_id);

  return tuple_id;
}
开发者ID:1uk3,项目名称:contiki,代码行数:25,代码来源:relation.c

示例11: ehgraph_copy

ehgraph_t* ehgraph_copy(ehgraph_t* graph) {
  bool bRet = false;
  ehgraph_t* ret = NULL;

  do {
    CheckNotNULL(graph);

    ret = ehgraph_alloc(NULL, graph->size, graph->ptrdim, graph->nLinks);
    if (NULL == ret) {
      DB_ERROR("allocation error");
      break;
    }

    ret->closed = graph->closed;
    ret->isTop = false;
    ret->isBottom = false;
    CheckedCall(ehgraph_transfer_info(ret, graph, graph->ptrdim + graph->size));
    bRet = true;
  } while(0);

  if (!bRet) 
    SafeFree(ret);
   
  return ret;
}
开发者ID:mihasighi,项目名称:celia-tools,代码行数:25,代码来源:ell_representation.c

示例12: permute_graph

ehgraph_t* permute_graph(ehgraph_t* graph, int* perm) {
  ehgraph_t* ret = NULL, *b = NULL;

  do {
    CheckNotNULL(graph);
    CheckNotNULL(perm);

    if (0 != perm[0]) {
      DB_ERROR("the null element should remain unchanged in the permutation");
      break;
    }
    
    b = ehgraph_alloc(NULL, graph->size, graph->ptrdim, graph->nLinks);
    if (!b) {
      DB_ERROR("allocation failed");
      break;
    }

    b->closed = graph->closed;

    for (enode_t i = 0; i < graph->ptrdim; ++i) 
      VAR2NODE(b, i) = perm[ VAR2NODE(graph, i) ];

    for (enode_t i = 0; i < graph->size; ++i) {
      GET_NODE(b, perm[i]).inDoubleLink = GET_NODE(graph, i).inDoubleLink;
      GET_NODE(b, perm[i]).outDoubleLink = GET_NODE(graph, i).outDoubleLink;

      for (size_t l = 0; l < graph->nLinks; ++l) {
	GET_LINK(b, perm[i], l) = perm[ GET_LINK(graph, i, l) ];
	GET_NODE(b, perm[i]).superEdge[l] = GET_NODE(graph, i).superEdge[l];

	for (size_t lp = 0; lp < graph->nLinks; ++lp) {
	  GET_NODE(b, perm[i]).isPredicate[l][lp] = GET_NODE(graph, i).isPredicate[l][lp];
	  GET_NODE(b, perm[i]).predicateTarget[l][lp] = perm[ GET_NODE(graph, i).predicateTarget[l][lp] ];
	}
      }
    }
	   
    ret = b;
  } while(0);
  
  if (!ret)
    SafeFree(b);
  
  return ret;
}
开发者ID:mihasighi,项目名称:celia-tools,代码行数:46,代码来源:ell_representation.c

示例13: ehgraph_del_pred

bool ehgraph_del_pred(ehgraph_t* graph, enode_t node, size_t edge, size_t link) {
  if (NULL == graph) {
    DB_ERROR("null argument");
    return false;
  }

  GET_NODE(graph, node).isPredicate[edge][link] = false;
  return true;
}
开发者ID:mihasighi,项目名称:celia-tools,代码行数:9,代码来源:ell_representation.c

示例14: get_block_blob_from_height

block BlockchainDB::get_block_from_height(const uint64_t& height) const
{
  blobdata bd = get_block_blob_from_height(height);
  block b;
  if (!parse_and_validate_block_from_blob(bd, b))
    throw DB_ERROR("Failed to parse block from blob retrieved from the db");

  return b;
}
开发者ID:Whiteblock,项目名称:monero,代码行数:9,代码来源:blockchain_db.cpp

示例15: get_block_blob

block BlockchainDB::get_block(const crypto::hash& h) const
{
  blobdata bd = get_block_blob(h);
  block b;
  if (!parse_and_validate_block_from_blob(bd, b))
    throw DB_ERROR("Failed to parse block from blob retrieved from the db");

  return b;
}
开发者ID:Whiteblock,项目名称:monero,代码行数:9,代码来源:blockchain_db.cpp


注:本文中的DB_ERROR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。