RenameDatabase() public method

Renames a Database in this Environment
This method wraps the native ups_env_rename_db function.
/// /// /// if the new Database name is reserved /// /// if a Database with this name does not exist /// /// if a Database with the new name already exists /// /// if memory could not be allocated /// ///
public RenameDatabase ( short oldName, short newName ) : void
oldName short The old name of the Database. If a Database /// with this name does not exist, the function will throw /// .
newName short The new name of the Database. If a Database /// with this name already exists, the function will throw /// .
return void
Example #1
0
 private void RenameDatabase()
 {
     Upscaledb.Environment env = new Upscaledb.Environment();
     byte[] k = new byte[5];
     byte[] r = new byte[5];
     try {
         env.Create("ntest.db");
         Database db = env.CreateDatabase((short)13);
         db.Insert(k, r);
         db.Close();
         env.RenameDatabase((short)13, (short)15);
         db = env.OpenDatabase((short)15);
         byte[] f = db.Find(k);
         checkEqual(r, f);
         // db.Close();
         env.Close();
     }
     catch (DatabaseException e) {
         Assert.Fail("unexpected exception " + e);
     }
 }
Example #2
0
 private void RenameDatabase()
 {
     Upscaledb.Environment env = new Upscaledb.Environment();
     byte[] k = new byte[5];
     byte[] r = new byte[5];
     try {
         env.Create("ntest.db");
         Database db = env.CreateDatabase((short)13);
         db.Insert(k, r);
         db.Close();
         env.RenameDatabase((short)13, (short)15);
         db = env.OpenDatabase((short)15);
         byte[] f = db.Find(k);
         checkEqual(r, f);
         // db.Close();
         env.Close();
     }
     catch (DatabaseException e) {
         Assert.Fail("unexpected exception " + e);
     }
 }