Upscaledb.Environment.EraseDatabase C# (CSharp) Method

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
        public void EraseDatabase(short name)
        {
            int st;
              lock (this) {
            st = NativeMethods.EnvEraseDatabase(handle, name, 0);
              }
              if (st != 0)
            throw new DatabaseException(st);
        }

Usage Example

Esempio n. 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();
        }
All Usage Examples Of Upscaledb.Environment::EraseDatabase