parameters: (self, table)
docstring: Remove an entire table from the database
docstring_summary: Remove an entire table from the database
docstring_tokens: Remove an entire table from the database
function: def Drop(self, table):
          """Remove an entire table from the database"""
          txn = None
          try:
              txn = self.env.txn_begin()
  
              # delete the column list
              self.db.delete(_columns_key(table), txn=txn)
  
              cur = self.db.cursor(txn)
  
              # delete all keys containing this tables column and row info
              table_key = _search_all_data_key(table)
              while 1:
                  try:
                      key, data = cur.set_range(table_key)
                  except db.DBNotFoundError:
                      break
                  # only delete items in this table
                  if key[:len(table_key)] != table_key:
                      break
                  cur.delete()
  
              # delete all rowids used by this table
              table_key = _search_rowid_key(table)
              while 1:
                  try:
                      key, data = cur.set_range(table_key)
                  except db.DBNotFoundError:
                      break
                  # only delete items in this table
                  if key[:len(table_key)] != table_key:
                      break
                  cur.delete()
  
              cur.close()
  
              # delete the tablename from the table name list
              tablelist = pickle.loads(
                  getattr(self.db, "get_bytes", self.db.get)(_table_names_key,
                      txn=txn, flags=db.DB_RMW))
              try:
                  tablelist.remove(table)
              except ValueError:
                  # hmm, it wasn't there, oh well, that's what we want.
                  pass
              # delete 1st, incase we opened with DB_DUP
              self.db.delete(_table_names_key, txn=txn)
              getattr(self.db, "put_bytes", self.db.put)(_table_names_key,
                      pickle.dumps(tablelist, 1), txn=txn)
  
              txn.commit()
              txn = None
  
              if table in self.__tablecolumns:
                  del self.__tablecolumns[table]
  
          except db.DBError, dberror:
              if txn:
                  txn.abort()
              raise TableDBError(dberror.args[1])
function_tokens: def Drop ( self , table ) : txn = None try : txn = self . env . txn_begin ( ) # delete the column list self . db . delete ( _columns_key ( table ) , txn = txn ) cur = self . db . cursor ( txn ) # delete all keys containing this tables column and row info table_key = _search_all_data_key ( table ) while 1 : try : key , data = cur . set_range ( table_key ) except db . DBNotFoundError : break # only delete items in this table if key [ : len ( table_key ) ] != table_key : break cur . delete ( ) # delete all rowids used by this table table_key = _search_rowid_key ( table ) while 1 : try : key , data = cur . set_range ( table_key ) except db . DBNotFoundError : break # only delete items in this table if key [ : len ( table_key ) ] != table_key : break cur . delete ( ) cur . close ( ) # delete the tablename from the table name list tablelist = pickle . loads ( getattr ( self . db , "get_bytes" , self . db . get ) ( _table_names_key , txn = txn , flags = db . DB_RMW ) ) try : tablelist . remove ( table ) except ValueError : # hmm, it wasn't there, oh well, that's what we want. pass # delete 1st, incase we opened with DB_DUP self . db . delete ( _table_names_key , txn = txn ) getattr ( self . db , "put_bytes" , self . db . put ) ( _table_names_key , pickle . dumps ( tablelist , 1 ) , txn = txn ) txn . commit ( ) txn = None if table in self . __tablecolumns : del self . __tablecolumns [ table ] except db . DBError , dberror : if txn : txn . abort ( ) raise TableDBError ( dberror . args [ 1 ] )