当前位置: 首页>>代码示例>>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;未经允许,请勿转载。