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