class DropView extends SchemaStatement {

    private String viewName;
    private boolean ifExists;
    private int dropAction;

    public DropView(ServerSession session, Schema schema) {
        super(session, schema);
        dropAction = session.getDatabase().getSettings().dropRestrict ? ConstraintReferential.RESTRICT
                : ConstraintReferential.CASCADE;
    }

    @Override
    public int getType() {
        return SQLStatement.DROP_VIEW;
    }

    public void setViewName(String viewName) {
        this.viewName = viewName;
    }

    public void setIfExists(boolean b) {
        ifExists = b;
    }

    public void setDropAction(int dropAction) {
        this.dropAction = dropAction;
    }

    @Override
    public int update() {<FILL_FUNCTION_BODY>}
}

        DbObjectLock lock = schema.tryExclusiveLock(DbObjectType.TABLE_OR_VIEW, session);
        if (lock == null)
            return -1;

        Table view = schema.findTableOrView(session, viewName);
        if (view == null) {
            if (!ifExists) {
                throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName);
            }
        } else {
            if (view.getTableType() != TableType.VIEW) {
                throw DbException.get(ErrorCode.VIEW_NOT_FOUND_1, viewName);
            }
            session.getUser().checkRight(view, Right.ALL);

            if (dropAction == ConstraintReferential.RESTRICT) {
                for (DbObject child : view.getChildren()) {
                    if (child instanceof TableView) {
                        throw DbException.get(ErrorCode.CANNOT_DROP_2, viewName, child.getName());
                    }
                }
            }
            schema.remove(session, view, lock);
        }
        return 0;
    
<methods>public void <init>(com.lealone.db.session.ServerSession, com.lealone.db.schema.Schema) <variables>protected final non-sealed com.lealone.db.schema.Schema schema