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


Java Database.removeSchemaObject方法代码示例

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


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

示例1: update

import org.h2.engine.Database; //导入方法依赖的package包/类
@Override
public int update() {
    session.commit(true);
    Database db = session.getDatabase();
    TriggerObject trigger = getSchema().findTrigger(triggerName);
    if (trigger == null) {
        if (!ifExists) {
            throw DbException.get(ErrorCode.TRIGGER_NOT_FOUND_1, triggerName);
        }
    } else {
        Table table = trigger.getTable();
        session.getUser().checkRight(table, Right.ALL);
        db.removeSchemaObject(session, trigger);
    }
    return 0;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:17,代码来源:DropTrigger.java

示例2: update

import org.h2.engine.Database; //导入方法依赖的package包/类
@Override
public int update() {
    session.getUser().checkAdmin();
    session.commit(true);
    Database db = session.getDatabase();
    Sequence sequence = getSchema().findSequence(sequenceName);
    if (sequence == null) {
        if (!ifExists) {
            throw DbException.get(ErrorCode.SEQUENCE_NOT_FOUND_1, sequenceName);
        }
    } else {
        if (sequence.getBelongsToTable()) {
            throw DbException.get(ErrorCode.SEQUENCE_BELONGS_TO_A_TABLE_1, sequenceName);
        }
        db.removeSchemaObject(session, sequence);
    }
    return 0;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:19,代码来源:DropSequence.java

示例3: removeSequence

import org.h2.engine.Database; //导入方法依赖的package包/类
private void removeSequence(Sequence sequence) {
    if (sequence != null) {
        table.removeSequence(sequence);
        sequence.setBelongsToTable(false);
        Database db = session.getDatabase();
        db.removeSchemaObject(session, sequence);
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:9,代码来源:AlterTableAlterColumn.java

示例4: update

import org.h2.engine.Database; //导入方法依赖的package包/类
@Override
public int update() {
    session.commit(true);
    Database db = session.getDatabase();
    Index index = getSchema().findIndex(session, indexName);
    if (index == null) {
        if (!ifExists) {
            throw DbException.get(ErrorCode.INDEX_NOT_FOUND_1, indexName);
        }
    } else {
        Table table = index.getTable();
        session.getUser().checkRight(index.getTable(), Right.ALL);
        Constraint pkConstraint = null;
        ArrayList<Constraint> constraints = table.getConstraints();
        for (int i = 0; constraints != null && i < constraints.size(); i++) {
            Constraint cons = constraints.get(i);
            if (cons.usesIndex(index)) {
                // can drop primary key index (for compatibility)
                if (Constraint.PRIMARY_KEY.equals(cons.getConstraintType())) {
                    pkConstraint = cons;
                } else {
                    throw DbException.get(
                            ErrorCode.INDEX_BELONGS_TO_CONSTRAINT_2,
                            indexName, cons.getName());
                }
            }
        }
        index.getTable().setModified();
        if (pkConstraint != null) {
            db.removeSchemaObject(session, pkConstraint);
        } else {
            db.removeSchemaObject(session, index);
        }
    }
    return 0;
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:37,代码来源:DropIndex.java

示例5: update

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

示例6: update

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

示例7: executeDrop

import org.h2.engine.Database; //导入方法依赖的package包/类
private void executeDrop() {
    // need to get the table again, because it may be dropped already
    // meanwhile (dependent object, or same object)
    table = getSchema().findTableOrView(session, tableName);

    if (table != null) {
        table.setModified();
        Database db = session.getDatabase();
        db.lockMeta(session);
        db.removeSchemaObject(session, table);
    }
    if (next != null) {
        next.executeDrop();
    }
}
 
开发者ID:vdr007,项目名称:ThriftyPaxos,代码行数:16,代码来源:DropTable.java


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