當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。