示例#1
0
 def drop_table(table_name):
     metadata = load_metadata()
     buffer_manager = BufferManager()
     MinisqlFacade.delete_record_all(table_name)
     shutil.rmtree('schema/tables/' + table_name + '/', True)
     buffer_manager.detach_from_file('schema/tables/' + table_name + '/' +
                                     table_name + '.table')
     for index_name in metadata.tables[table_name].indexes:
         buffer_manager.detach_from_file('schema/tables/' + table_name +
                                         '/' + index_name + '.index')
     metadata.drop_table(table_name)
     metadata.dump()
示例#2
0
 def test_detach(self):
     manager = BufferManager()
     manager.get_file_block('foo', 0)
     manager.detach_from_file('foo')
     self.assertFalse(manager._blocks)