removeclass (Vapor::RepositoryManager)

    # File vapor/repositorymgr.rb, line 345
        def removeclass( klass, recursive )
          klass = known_classes().find{|k| k.name == klass.to_s }

          # check if the class is known to the repository
          raise ClassNotKnownError unless klass

          # check if the class has any child  classes
          children = known_classes().select{|k| k.superclass == klass.name }.collect{|k| k.name}

          if !children.empty? then  # child classes exist
            if recursive then       # delete children recursivly
              children.each{|c| removeclass( c, recursive ) }
            else                    # don't delete children
              raise ClassNotDeletableError.new( "Class is not deletable because of child classes", children )
            end                     # recursion?
          end                       # children?

          ## let's start removing, start with meta-data

          # first get class's oid
          oid = @dbh.execute( %!SELECT _oid FROM ":Vapor::ClassMetaData" WHERE _name = '#{klass.name}'! ).fetch[0]

          # remove attributes
          @dbh.execute( %!DELETE FROM ":Vapor::AttributeMetaData" WHERE _oid = #{oid}! )

          # remove class itself
          @dbh.execute( %!DELETE FROM ":Vapor::ClassMetaData" WHERE _oid = '#{oid}' ! )

          ## remove tables, shouldn't be a problem, child classes have been removed
          @dbh.execute( %!DROP TABLE "_#{klass.table}"! )  # historic
          @dbh.execute( %!DROP TABLE "#{klass.table}"! )   # actual data

          ## remove from list of known classes
          known_classes().delete( klass )

        end