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

    if (!returning.equalsIgnoreCase("COUNT"))
      allDeletedRecords = new ArrayList<ORecord>();

    txAlreadyBegun = getDatabase().getTransaction().isActive();

    ODatabaseDocumentInternal db = getDatabase();
    if (rid != null) {
      // REMOVE PUNCTUAL RID
      db.begin();
      final OVertex v = toVertex(rid);
      if (v != null) {
        v.delete();
        removed = 1;
      }
      db.commit();

    } else if (query != null) {
      // TARGET IS A CLASS + OPTIONAL CONDITION
      db.begin();
      // TARGET IS A CLASS + OPTIONAL CONDITION

      query.setContext(getContext());
      query.execute(iArgs);
      db.commit();

    } else
      throw new OCommandExecutionException("Invalid target");

    if (returning.equalsIgnoreCase("COUNT"))
      // RETURNS ONLY THE COUNT
      return removed;
    else
      // RETURNS ALL THE DELETED RECORDS
      return allDeletedRecords;
  }
public Object execute(final Map<Object, Object> iArgs) {
    if (rid == null && query == null)
      throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");

    if (!returning.equalsIgnoreCase("COUNT"))
      allDeletedRecords = new ArrayList<ORecord>();

    txAlreadyBegun = getDatabase().getTransaction().isActive();

    ODatabaseDocumentInternal db = getDatabase();
    if (rid != null) {
      // REMOVE PUNCTUAL RID
      db.begin();
      final OVertex v = toVertex(rid);
      if (v != null) {
        v.delete();
        removed = 1;
      }
      db.commit();

    } else if (query != null) {
      // TARGET IS A CLASS + OPTIONAL CONDITION
      db.begin();
      // TARGET IS A CLASS + OPTIONAL CONDITION

      query.setContext(getContext());
      query.execute(iArgs);
      db.commit();

    } else
      throw new OCommandExecutionException("Invalid target");

    if (returning.equalsIgnoreCase("COUNT"))
      // RETURNS ONLY THE COUNT
      return removed;
    else
      // RETURNS ALL THE DELETED RECORDS
      return allDeletedRecords;
  }
public Object execute ( final Map < Object , Object > iArgs ) { if ( rid == null && query == null ) throw new OCommandExecutionException ( "Cannot execute the command because it has not been parsed yet" ) ; if ( ! returning . equalsIgnoreCase ( "COUNT" ) ) allDeletedRecords = new ArrayList < ORecord > ( ) ; txAlreadyBegun = getDatabase ( ) . getTransaction ( ) . isActive ( ) ; ODatabaseDocumentInternal db = getDatabase ( ) ; if ( rid != null ) { // REMOVE PUNCTUAL RID db . begin ( ) ; final OVertex v = toVertex ( rid ) ; if ( v != null ) { v . delete ( ) ; removed = 1 ; } db . commit ( ) ; } else if ( query != null ) { // TARGET IS A CLASS + OPTIONAL CONDITION db . begin ( ) ; // TARGET IS A CLASS + OPTIONAL CONDITION query . setContext ( getContext ( ) ) ; query . execute ( iArgs ) ; db . commit ( ) ; } else throw new OCommandExecutionException ( "Invalid target" ) ; if ( returning . equalsIgnoreCase ( "COUNT" ) ) // RETURNS ONLY THE COUNT return removed ; else // RETURNS ALL THE DELETED RECORDS return allDeletedRecords ; }
Execute the command and return the ODocument object created.
Execute the command and return the ODocument object created .