DbEnv::dbrename |
![]()
|
#include <db_cxx.h>int DbEnv::dbrename(DbTxn *txnid, const char *file, const char *database, const char *newname, u_int32_t flags);
The DbEnv::dbrename method renames the database specified by the file and database arguments to newname. If no database is specified, the underlying file represented by file is renamed, incidentally renaming all databases that it contained.
Applications should not rename databases that are currently in use. If an underlying file is being renamed and logging is currently enabled in the database environment, no database in the file may be open when the DbEnv::dbrename method is called. In particular, some architectures do not permit renaming files with open handles. On these architectures, attempts to rename databases that are currently in use by any thread of control in the system will fail.
If the operation is to be transaction-protected, the txnid parameter is a transaction handle returned from DbEnv::txn_begin; otherwise, NULL.
The flags value must be set to 0 or the following value:
The DbEnv::dbrename method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.
DbEnv::dbre return.
The constructor creates the DbEnv object. The constructor allocates memory internally; calling the DbEnv::close or DbEnv::remove methods will free that memory.
The following flags value may be specified:
The DB_CLIENT flag indicates to the system that this environment is remote on a server. The use of this flag causes the environment methods to use functions that call a server instead of local functions. Prior to making any environment or database method calls, the application must call the DbEnv::set_rpc_server method to establish the connection to the server.
Each DbEnv object has an associated DB_ENV structure, which is used by the underlying implementation of Berkeley DB and its C-language API. The DbEnv::get_DB_ENV method returns a pointer to this struct. Given a const DbEnv object, DbEnv::get_const_DB_ENV returns a const pointer to the same struct.
Given a DB_ENV struct, the DbEnv::get_DbEnv method returns the corr