當前位置: 首頁>>代碼示例>>Java>>正文


Java Database.renameSchemaObject方法代碼示例

本文整理匯總了Java中org.h2.engine.Database.renameSchemaObject方法的典型用法代碼示例。如果您正苦於以下問題:Java Database.renameSchemaObject方法的具體用法?Java Database.renameSchemaObject怎麽用?Java Database.renameSchemaObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.h2.engine.Database的用法示例。


在下文中一共展示了Database.renameSchemaObject方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkViews

import org.h2.engine.Database; //導入方法依賴的package包/類
/**
 * Check that all views and other dependent objects.
 */
private void checkViews(SchemaObject sourceTable, SchemaObject newTable) {
    String sourceTableName = sourceTable.getName();
    String newTableName = newTable.getName();
    Database db = sourceTable.getDatabase();
    // save the real table under a temporary name
    String temp = db.getTempTableName(sourceTableName, session);
    db.renameSchemaObject(session, sourceTable, temp);
    try {
        // have our new table impersonate the target table
        db.renameSchemaObject(session, newTable, sourceTableName);
        checkViewsAreValid(sourceTable);
    } finally {
        // always put the source tables back with their proper names
        try {
            db.renameSchemaObject(session, newTable, newTableName);
        } finally {
            db.renameSchemaObject(session, sourceTable, sourceTableName);
        }
    }
}
 
開發者ID:vdr007,項目名稱:ThriftyPaxos,代碼行數:24,代碼來源:AlterTableAlterColumn.java

示例2: update

import org.h2.engine.Database; //導入方法依賴的package包/類
@Override
public int update() {
    session.commit(true);
    Database db = session.getDatabase();
    session.getUser().checkRight(oldTable, Right.ALL);
    Table t = getSchema().findTableOrView(session, newTableName);
    if (t != null && hidden && newTableName.equals(oldTable.getName())) {
        if (!t.isHidden()) {
            t.setHidden(hidden);
            oldTable.setHidden(true);
            db.updateMeta(session, oldTable);
        }
        return 0;
    }
    if (t != null || newTableName.equals(oldTable.getName())) {
        throw DbException.get(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, newTableName);
    }
    if (oldTable.isTemporary()) {
        throw DbException.getUnsupportedException("temp table");
    }
    db.renameSchemaObject(session, oldTable, newTableName);
    return 0;
}
 
開發者ID:vdr007,項目名稱:ThriftyPaxos,代碼行數:24,代碼來源:AlterTableRename.java

示例3: update

import org.h2.engine.Database; //導入方法依賴的package包/類
@Override
public int update() {
    session.commit(true);
    Database db = session.getDatabase();
    Schema schema = oldIndex.getSchema();
    if (schema.findIndex(session, newIndexName) != null ||
            newIndexName.equals(oldIndex.getName())) {
        throw DbException.get(ErrorCode.INDEX_ALREADY_EXISTS_1,
                newIndexName);
    }
    session.getUser().checkRight(oldIndex.getTable(), Right.ALL);
    db.renameSchemaObject(session, oldIndex, newIndexName);
    return 0;
}
 
開發者ID:vdr007,項目名稱:ThriftyPaxos,代碼行數:15,代碼來源:AlterIndexRename.java


注:本文中的org.h2.engine.Database.renameSchemaObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。