core/src/main/java/com/orientechnologies/orient/core/sql/OCommandExecutorSQLDropClass.java
public Object execute(final Map<Object, Object> iArgs) {
    if (className == null) {
      throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
    }

    final ODatabaseDocument database = getDatabase();
    if (ifExists && !database.getMetadata().getSchema().existsClass(className)) {
      return true;
    }
    final OClass cls = database.getMetadata().getSchema().getClass(className);
    if (cls == null) {
      return null;
    }

    final long records = cls.count(true);

    if (records > 0 && !unsafe) {
      // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES
      if (cls.isSubClassOf("V")) {
        // FOUND VERTEX CLASS
        throw new OCommandExecutionException("'DROP CLASS' command cannot drop class '" + className
            + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid broken edges in a database, or apply the 'UNSAFE' keyword to force it");
      } else if (cls.isSubClassOf("E")) {
        // FOUND EDGE CLASS
        throw new OCommandExecutionException("'DROP CLASS' command cannot drop class '" + className
            + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken vertices in a database, or apply the 'UNSAFE' keyword to force it");
      }
    }

    database.getMetadata().getSchema().dropClass(className);

    if (records > 0 && unsafe) {
      // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES
      if (cls.isSubClassOf("V")) {
        // FOUND VERTICES
        if (unsafe)
          OLogManager.instance().warn(this,
              "Dropped class '%s' containing %d vertices using UNSAFE mode. Database could contain broken edges", className,
              records);
      } else if (cls.isSubClassOf("E")) {
        // FOUND EDGES
        OLogManager.instance().warn(this,
            "Dropped class '%s' containing %d edges using UNSAFE mode. Database could contain broken vertices", className, records);
      }
    }

    return true;
  }
public Object execute(final Map<Object, Object> iArgs) {
    if (className == null) {
      throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
    }

    final ODatabaseDocument database = getDatabase();
    if (ifExists && !database.getMetadata().getSchema().existsClass(className)) {
      return true;
    }
    final OClass cls = database.getMetadata().getSchema().getClass(className);
    if (cls == null) {
      return null;
    }

    final long records = cls.count(true);

    if (records > 0 && !unsafe) {
      // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES
      if (cls.isSubClassOf("V")) {
        // FOUND VERTEX CLASS
        throw new OCommandExecutionException("'DROP CLASS' command cannot drop class '" + className
            + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid broken edges in a database, or apply the 'UNSAFE' keyword to force it");
      } else if (cls.isSubClassOf("E")) {
        // FOUND EDGE CLASS
        throw new OCommandExecutionException("'DROP CLASS' command cannot drop class '" + className
            + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken vertices in a database, or apply the 'UNSAFE' keyword to force it");
      }
    }

    database.getMetadata().getSchema().dropClass(className);

    if (records > 0 && unsafe) {
      // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES
      if (cls.isSubClassOf("V")) {
        // FOUND VERTICES
        if (unsafe)
          OLogManager.instance().warn(this,
              "Dropped class '%s' containing %d vertices using UNSAFE mode. Database could contain broken edges", className,
              records);
      } else if (cls.isSubClassOf("E")) {
        // FOUND EDGES
        OLogManager.instance().warn(this,
            "Dropped class '%s' containing %d edges using UNSAFE mode. Database could contain broken vertices", className, records);
      }
    }

    return true;
  }
public Object execute ( final Map < Object , Object > iArgs ) { if ( className == null ) { throw new OCommandExecutionException ( "Cannot execute the command because it has not been parsed yet" ) ; } final ODatabaseDocument database = getDatabase ( ) ; if ( ifExists && ! database . getMetadata ( ) . getSchema ( ) . existsClass ( className ) ) { return true ; } final OClass cls = database . getMetadata ( ) . getSchema ( ) . getClass ( className ) ; if ( cls == null ) { return null ; } final long records = cls . count ( true ) ; if ( records > 0 && ! unsafe ) { // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES
 if ( cls . isSubClassOf ( "V" ) ) { // FOUND VERTEX CLASS
 throw new OCommandExecutionException ( "'DROP CLASS' command cannot drop class '" + className + "' because it contains Vertices. Use 'DELETE VERTEX' command first to avoid broken edges in a database, or apply the 'UNSAFE' keyword to force it" ) ; } else if ( cls . isSubClassOf ( "E" ) ) { // FOUND EDGE CLASS
 throw new OCommandExecutionException ( "'DROP CLASS' command cannot drop class '" + className + "' because it contains Edges. Use 'DELETE EDGE' command first to avoid broken vertices in a database, or apply the 'UNSAFE' keyword to force it" ) ; } } database . getMetadata ( ) . getSchema ( ) . dropClass ( className ) ; if ( records > 0 && unsafe ) { // NOT EMPTY, CHECK IF CLASS IS OF VERTEX OR EDGES
 if ( cls . isSubClassOf ( "V" ) ) { // FOUND VERTICES
 if ( unsafe ) OLogManager . instance ( ) . warn ( this , "Dropped class '%s' containing %d vertices using UNSAFE mode. Database could contain broken edges" , className , records ) ; } else if ( cls . isSubClassOf ( "E" ) ) { // FOUND EDGES
 OLogManager . instance ( ) . warn ( this , "Dropped class '%s' containing %d edges using UNSAFE mode. Database could contain broken vertices" , className , records ) ; } } return true ; }
Execute the DROP CLASS.
Execute the DROP CLASS .