EraseDatabase() public method

Deletes a Database from this Environment
This method wraps the native ups_env_erase_db function.
/// /// /// if a Database with this name does not exist /// /// if the Database with the new name is still open /// ///
public EraseDatabase ( short name ) : void
name short The name of the Database which is deleted. /// If a Database with this name does not exist, the function will throw /// .
return void
示例#1
0
        private void EraseUnknownDatabase()
        {
            Upscaledb.Environment env = new Upscaledb.Environment();
            byte[] k = new byte[5];
            byte[] r = new byte[5];

            env.Create("ntest.db");
            Database db = env.CreateDatabase((short)13);

            db.Insert(k, r);
            db.Close();
            try {
                env.EraseDatabase((short)99);
            }
            catch (DatabaseException e) {
                Assert.AreEqual(UpsConst.UPS_DATABASE_NOT_FOUND, e.ErrorCode);
            }
            env.Close();
        }
示例#2
0
        private void EraseUnknownDatabase()
        {
            Upscaledb.Environment env = new Upscaledb.Environment();
            byte[] k = new byte[5];
            byte[] r = new byte[5];

            env.Create("ntest.db");
            Database db = env.CreateDatabase((short)13);
            db.Insert(k, r);
            db.Close();
            try {
                env.EraseDatabase((short)99);
            }
            catch (DatabaseException e) {
                Assert.AreEqual(UpsConst.UPS_DATABASE_NOT_FOUND, e.ErrorCode);
            }
            env.Close();
        }