本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}