当前位置: 首页>>代码示例>>Java>>正文


Java Database.removeDatabaseObject方法代码示例

本文整理汇总了Java中org.h2.engine.Database.removeDatabaseObject方法的典型用法代码示例。如果您正苦于以下问题:Java Database.removeDatabaseObject方法的具体用法?Java Database.removeDatabaseObject怎么用?Java Database.removeDatabaseObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.h2.engine.Database的用法示例。


在下文中一共展示了Database.removeDatabaseObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import org.h2.engine.Database; //导入方法依赖的package包/类
@Override
public int update() {
    session.getUser().checkSchemaAdmin();
    session.commit(true);
    Database db = session.getDatabase();
    Schema schema = db.findSchema(schemaName);
    if (schema == null) {
        if (!ifExists) {
            throw DbException.get(ErrorCode.SCHEMA_NOT_FOUND_1, schemaName);
        }
    } else {
        if (!schema.canDrop()) {
            throw DbException.get(ErrorCode.SCHEMA_CAN_NOT_BE_DROPPED_1, schemaName);
        }
        db.removeDatabaseObject(session, schema);
    }
    return 0;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:19,代码来源:DropSchema.java

示例2: revokeRight

import org.h2.engine.Database; //导入方法依赖的package包/类
private void revokeRight() {
    for (Table table : tables) {
        Right right = grantee.getRightForTable(table);
        if (right == null) {
            continue;
        }
        int mask = right.getRightMask();
        int newRight = mask & ~rightMask;
        Database db = session.getDatabase();
        if (newRight == 0) {
            db.removeDatabaseObject(session, right);
        } else {
            right.setRightMask(newRight);
            db.updateMeta(session, right);
        }
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:18,代码来源:GrantRevoke.java

示例3: update

import org.h2.engine.Database; //导入方法依赖的package包/类
@Override
public int update() {
    session.getUser().checkAdmin();
    session.commit(true);
    Database db = session.getDatabase();
    if (roleName.equals(Constants.PUBLIC_ROLE_NAME)) {
        throw DbException.get(ErrorCode.ROLE_CAN_NOT_BE_DROPPED_1, roleName);
    }
    Role role = db.findRole(roleName);
    if (role == null) {
        if (!ifExists) {
            throw DbException.get(ErrorCode.ROLE_NOT_FOUND_1, roleName);
        }
    } else {
        db.removeDatabaseObject(session, role);
    }
    return 0;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:19,代码来源:DropRole.java

示例4: update

import org.h2.engine.Database; //导入方法依赖的package包/类
@Override
public int update() {
    session.getUser().checkAdmin();
    session.commit(true);
    Database db = session.getDatabase();
    User user = db.findUser(userName);
    if (user == null) {
        if (!ifExists) {
            throw DbException.get(ErrorCode.USER_NOT_FOUND_1, userName);
        }
    } else {
        if (user == session.getUser()) {
            int adminUserCount = 0;
            for (User u : db.getAllUsers()) {
                if (u.isAdmin()) {
                    adminUserCount++;
                }
            }
            if (adminUserCount == 1) {
                throw DbException.get(ErrorCode.CANNOT_DROP_CURRENT_USER);
            }
        }
        user.checkOwnsNoSchemas();
        db.removeDatabaseObject(session, user);
    }
    return 0;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:28,代码来源:DropUser.java

示例5: update

import org.h2.engine.Database; //导入方法依赖的package包/类
@Override
public int update() {
    session.getUser().checkAdmin();
    session.commit(true);
    Database db = session.getDatabase();
    UserAggregate aggregate = db.findAggregate(name);
    if (aggregate == null) {
        if (!ifExists) {
            throw DbException.get(ErrorCode.AGGREGATE_NOT_FOUND_1, name);
        }
    } else {
        db.removeDatabaseObject(session, aggregate);
    }
    return 0;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:16,代码来源:DropAggregate.java

示例6: revokeRole

import org.h2.engine.Database; //导入方法依赖的package包/类
private void revokeRole(Role grantedRole) {
    Right right = grantee.getRightForRole(grantedRole);
    if (right == null) {
        return;
    }
    Database db = session.getDatabase();
    db.removeDatabaseObject(session, right);
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:9,代码来源:GrantRevoke.java

示例7: update

import org.h2.engine.Database; //导入方法依赖的package包/类
@Override
public int update() {
    session.getUser().checkAdmin();
    session.commit(true);
    Database db = session.getDatabase();
    UserDataType type = db.findUserDataType(typeName);
    if (type == null) {
        if (!ifExists) {
            throw DbException.get(ErrorCode.USER_DATA_TYPE_NOT_FOUND_1, typeName);
        }
    } else {
        db.removeDatabaseObject(session, type);
    }
    return 0;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:16,代码来源:DropUserDataType.java


注:本文中的org.h2.engine.Database.removeDatabaseObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。