#include <db_cxx.h> int Db::convert(const char *file, u_int32_t lorder);
The Db::convert()
method converts all of the databases included in
the file file to a specified byte order, if necessary.
If no conversion is necessary, Db::convert()
always returns success.
If the database is partitioned, Db::set_partition() must be called before this method in order to convert all database partitions.
Database conversions are done in place and are destructive. For example, if pages need to be allocated and no disk space is available, the database may be left corrupted. Backups should be made before databases are converted.
The Db::convert()
method is non-atomic
when used on a partitioned or sliced database, or a database with
multiple queue extent files. If the operation fails, it is
possible for the underlying database files to be in an
inconsistent state.
The Db::convert()
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.
If the database was opened within a database environment, the
environment variable DB_HOME
may be used as the path of the
database environment home.
Db::convert()
is affected by any database directory specified using the
DbEnv::add_data_dir()
method, or by setting the "add_data_dir" string
in the environment's DB_CONFIG file.
The Db::convert()
method may fail and throw a DbException
exception, encapsulating one of the following non-zero errors, or return one
of the following non-zero errors: