本文整理汇总了C++中DB_ENV::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ DB_ENV::remove方法的具体用法?C++ DB_ENV::remove怎么用?C++ DB_ENV::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_ENV
的用法示例。
在下文中一共展示了DB_ENV::remove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: db_fini
static int db_fini(dbiIndex dbi, const char * dbhome,
const char * dbfile,
const char * dbsubfile)
{
rpmdb rpmdb = dbi->dbi_rpmdb;
DB_ENV * dbenv = rpmdb->db_dbenv;
int rc;
if (dbenv == NULL)
return 0;
rc = dbenv->close(dbenv, 0);
rc = cvtdberr(dbi, "dbenv->close", rc, _debug);
if (dbfile)
rpmlog(RPMLOG_DEBUG, "closed db environment %s/%s\n",
dbhome, dbfile);
if (rpmdb->db_remove_env) {
int xx;
xx = db_env_create(&dbenv, 0);
xx = cvtdberr(dbi, "db_env_create", xx, _debug);
xx = dbenv->remove(dbenv, dbhome, 0);
xx = cvtdberr(dbi, "dbenv->remove", xx, _debug);
if (dbfile)
rpmlog(RPMLOG_DEBUG, "removed db environment %s/%s\n",
dbhome, dbfile);
}
return rc;
}
示例2: remove
int DbEnv::remove(const char *db_home, u_int32_t flags)
{
int ret;
DB_ENV *env = unwrap(this);
// after a remove (no matter if success or failure),
// the underlying DB_ENV object must not be accessed,
// so we clean up in advance.
//
cleanup();
if ((ret = env->remove(env, db_home, flags)) != 0)
DB_ERROR(this, "DbEnv::remove", ret, error_policy());
return (ret);
}
示例3: remove_dbenv
int remove_dbenv(char *home)
{
DB_ENV *dbenv;
int ret;
if ((ret = db_env_create(&dbenv, 0)) != 0) {
ci_debug_printf(1, " %s\n", db_strerror(ret));
return 0;
}
if(dbenv->remove(dbenv, home, 0)!=0){
ci_debug_printf(1, "Error removing environment....\n");
return 0;
}
else
ci_debug_printf(5, "OK removing environment\n");
return 1;
}
示例4: assert
/*
* Forcebly removes the database environment.
*
* ARGUMENTS:
* path Pathname of the database directory. Shall not be NULL.
* The client can free it upon return.
* RETURNS:
* 0 Success.
* ENOMEM System error. "log_start()" called.
* EIO Backend database error. "log_start()" called.
*/
static RegStatus
removeEnvironment(
const char* const path)
{
RegStatus status;
DB_ENV* env;
assert(NULL != path);
if (0 == (status = createEnvHandle(path, &env))) {
if (status = env->remove(env, path, DB_FORCE)) {
log_add("Couldn't remove environment for database \"%s\"", path);
status = EIO;
}
} /* "env" allocated */
return status;
}
示例5: db_fini
static int db_fini(rpmdb rdb, const char * dbhome)
{
DB_ENV * dbenv = rdb->db_dbenv;
int rc;
int lockfd = -1;
uint32_t eflags = 0;
if (dbenv == NULL)
return 0;
if (rdb->db_opens > 1) {
rdb->db_opens--;
return 0;
}
(void) dbenv->get_open_flags(dbenv, &eflags);
if (!(eflags & DB_PRIVATE))
lockfd = serialize_env(dbhome);
rc = dbenv->close(dbenv, 0);
rc = dbapi_err(rdb, "dbenv->close", rc, _debug);
rpmlog(RPMLOG_DEBUG, "closed db environment %s\n", dbhome);
if (!(eflags & DB_PRIVATE) && rdb->db_remove_env) {
int xx;
xx = db_env_create(&dbenv, 0);
xx = dbapi_err(rdb, "db_env_create", xx, _debug);
xx = dbenv->remove(dbenv, dbhome, 0);
/* filter out EBUSY as it just means somebody else gets to clean it */
xx = dbapi_err(rdb, "dbenv->remove", xx, (xx == EBUSY ? 0 : _debug));
rpmlog(RPMLOG_DEBUG, "removed db environment %s\n", dbhome);
}
if (lockfd >= 0)
close(lockfd);
return rc;
}
示例6:
static int
databaseEnvRemove(const char* dbenvpath,
int flags)
{
#ifdef TRACE_FUNC_CALLS
LOG_TRACE_IN;
#endif
DB_ENV* localDbEnvHandle;
int ret;
// Removing the database file
db_env_create(&localDbEnvHandle, 0);
ret = localDbEnvHandle->remove(localDbEnvHandle,
dbenvpath,
flags);
#ifdef TRACE_FUNC_CALLS
LOG_TRACE_OUT;
#endif
return ret;
}
示例7: clearDbEnv
void RepNode::clearDbEnv()
{
// Clear the existing environment. Transaction is needless in this part.
if (access(envHome_.c_str(), 0) < 0) {
mkdir(envHome_.c_str(), 0755);
} else {
// Remove Container
{
DB_ENV* dbenv;
createDbEnv(&dbenv, 0);
dbenv->open(dbenv, envHome_.c_str(), envFlags_, 0);
XmlManager mgr(dbenv, DBXML_ADOPT_DBENV);
try {
mgr.removeContainer(containerName_);
} catch (...) {}
}
// Remove Environment
DB_ENV* dbEnvRemove;
createDbEnv(&dbEnvRemove, 0);
dbEnvRemove->remove(dbEnvRemove, envHome_.c_str(), DB_FORCE);
}
}