Examples of renameSchemaObject()


Examples of org.h2.engine.Database.renameSchemaObject()

        }
        session.getUser().checkRight(oldTable, Right.ALL);
        if (oldTable.isTemporary()) {
            throw DbException.getUnsupportedException("TEMP TABLE");
        }
        db.renameSchemaObject(session, oldTable, newTableName);
        return 0;
    }

}
View Full Code Here

Examples of org.h2.engine.Database.renameSchemaObject()

            execute("DROP TABLE " + newTable.getName(), true);
            throw DbException.get(ErrorCode.VIEW_IS_INVALID_2, e, getSQL(), e.getMessage());
        }
        String tableName = table.getName();
        execute("DROP TABLE " + table.getSQL(), true);
        db.renameSchemaObject(session, newTable, tableName);
        for (DbObject child : newTable.getChildren()) {
            if (child instanceof Sequence) {
                continue;
            }
            String name = child.getName();
View Full Code Here

Examples of org.h2.engine.Database.renameSchemaObject()

                } else if (so instanceof Index) {
                    if (so.getSchema().findIndex(session, name) != null) {
                        name = so.getSchema().getUniqueIndexName(session, newTable, name);
                    }
                }
                db.renameSchemaObject(session, so, name);
            }
        }
        for (String view : views) {
            execute(view, true);
        }
View Full Code Here

Examples of org.h2.engine.Database.renameSchemaObject()

        List<String> viewSql = new ArrayList<String>();
        String sourceTableName = sourceTable.getName();
        String newTableName = newTable.getName();
        Database db = sourceTable.getDatabase();
        // save the real table under a temporary name
        db.renameSchemaObject(session, sourceTable, db.getTempTableName(session));
        try {
            // have our new table impersonate the target table
            db.renameSchemaObject(session, newTable, sourceTableName);
            checkViewsAreValid(sourceTable, viewSql);
        } finally {
View Full Code Here

Examples of org.h2.engine.Database.renameSchemaObject()

        Database db = sourceTable.getDatabase();
        // save the real table under a temporary name
        db.renameSchemaObject(session, sourceTable, db.getTempTableName(session));
        try {
            // have our new table impersonate the target table
            db.renameSchemaObject(session, newTable, sourceTableName);
            checkViewsAreValid(sourceTable, viewSql);
        } finally {
            // always put the source tables back with their proper names
            try {
                db.renameSchemaObject(session, newTable, newTableName);
View Full Code Here

Examples of org.h2.engine.Database.renameSchemaObject()

            db.renameSchemaObject(session, newTable, sourceTableName);
            checkViewsAreValid(sourceTable, viewSql);
        } finally {
            // always put the source tables back with their proper names
            try {
                db.renameSchemaObject(session, newTable, newTableName);
            } finally {
                db.renameSchemaObject(session, sourceTable, sourceTableName);
            }
        }
        return viewSql;
View Full Code Here

Examples of org.h2.engine.Database.renameSchemaObject()

        } finally {
            // always put the source tables back with their proper names
            try {
                db.renameSchemaObject(session, newTable, newTableName);
            } finally {
                db.renameSchemaObject(session, sourceTable, sourceTableName);
            }
        }
        return viewSql;
    }
View Full Code Here

Examples of org.h2.engine.Database.renameSchemaObject()

        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;
    }

}
View Full Code Here

Examples of org.h2.engine.Database.renameSchemaObject()

            if (ifNotExists) {
                return 0;
            }

            if (orReplace && existingView.getTableType().equals(Table.VIEW)) {
                db.renameSchemaObject(session, existingView, db.getTempTableName(session));
                loadDependentViewSql(existingView, dependentViewSql);
            } else {
                throw DbException.get(ErrorCode.VIEW_ALREADY_EXISTS_1, viewName);
            }
        }
View Full Code Here

Examples of org.lealone.engine.Database.renameSchemaObject()

            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;
    }

    public int getType() {
        return CommandInterface.ALTER_TABLE_RENAME;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.