=== modified file 'library/python/workbench/database_schema_selector_widget.py' --- library/python/workbench/database_schema_selector_widget.py revid:alfredo.kengi.kojima@oracle.com-20130827185054-377hmvt719gflrh9 +++ library/python/workbench/database_schema_selector_widget.py revid:sergio.delacruz@oracle.com-20130827223754-nu3v1v6svq1fegay @@ -1,4 +1,4 @@ -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -206,7 +206,7 @@ for schema_node in self._schema_nodes: if schema_node.get_bool(0) != checked: continue - catalog_name, dot, schema_name = schema_node.get_tag().partition('.') + catalog_name, dot, schema_name = schema_node.get_tag().rpartition('.') catalog_schemata.setdefault(catalog_name, []).append(schema_name) return catalog_schemata else: === modified file 'modules/db.generic/db_generic_migration_grt.py' --- modules/db.generic/db_generic_migration_grt.py revid:alfredo.kengi.kojima@oracle.com-20130827185054-377hmvt719gflrh9 +++ modules/db.generic/db_generic_migration_grt.py revid:sergio.delacruz@oracle.com-20130827223754-nu3v1v6svq1fegay @@ -1,4 +1,4 @@ -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -62,7 +62,7 @@ return False return True - def migrateIdentifier(self, name, log): + def migrateIdentifier(self, name, log, dots_allowed=False): mysql_name = name # truncate too long identifiers if len(mysql_name) > 64: @@ -343,7 +343,7 @@ target_column = grt.classes.db_mysql_Column() target_column.owner = targetTable log = state.addMigrationLogEntry(0, source_column, target_column, "") - target_column.name = self.migrateIdentifier(source_column.name, log) + target_column.name = self.migrateIdentifier(source_column.name, log, dots_allowed=True) target_column.oldName = source_column.name for flag in source_column.flags: @@ -389,7 +389,7 @@ target_index = grt.classes.db_mysql_Index() log = state.addMigrationLogEntry(0, source_index, target_index, "") target_index.owner = targetTable - target_index.name = self.migrateIdentifier(source_index.name, log) + target_index.name = self.migrateIdentifier(source_index.name, log, dots_allowed=True) target_index.oldName = source_index.name target_index.isPrimary = source_index.isPrimary @@ -464,7 +464,7 @@ state.addMigrationLogEntry(1, source_fk, target_fk, 'The foreign key constraint name "%s" is duplicated. Changed to "%s"' % (source_fk.name, fk_name)) - target_fk.name = self.migrateIdentifier(fk_name, log) + target_fk.name = self.migrateIdentifier(fk_name, log, dots_allowed=True) key_names[sourceSchema.name].add(fk_name) target_fk.oldName = source_fk.name @@ -503,7 +503,7 @@ try: target_fk_col = self.findMatchingTargetObject(state, source_fk_column) if not target_fk_col: - raise ValueError, 'The column "%s" was not found in table "%s"' % (self.migrateIdentifier(source_fk_column.name, None), targetTable.name) + raise ValueError, 'The column "%s" was not found in table "%s"' % (self.migrateIdentifier(source_fk_column.name, None, dots_allowed=True), targetTable.name) target_fk.columns.append(target_fk_col) except Exception, err: state.addMigrationLogEntry(2, source_fk, target_fk, @@ -519,7 +519,7 @@ try: target_fk_col = self.findMatchingTargetObject(state, source_fk_column) if not target_fk_col: - raise ValueError, 'The column "%s" was not found in table "%s"' % (self.migrateIdentifier(source_fk_column.name, None), target_fk.referencedTable.name) + raise ValueError, 'The column "%s" was not found in table "%s"' % (self.migrateIdentifier(source_fk_column.name, None, dots_allowed=True), target_fk.referencedTable.name) target_fk.referencedColumns.append(target_fk_col) except Exception, err: state.addMigrationLogEntry(2, source_fk, target_fk, === modified file 'modules/db.mssql/db_mssql_migration_grt.py' --- modules/db.mssql/db_mssql_migration_grt.py revid:alfredo.kengi.kojima@oracle.com-20130827185054-377hmvt719gflrh9 +++ modules/db.mssql/db_mssql_migration_grt.py revid:sergio.delacruz@oracle.com-20130827223754-nu3v1v6svq1fegay @@ -16,6 +16,7 @@ # 02110-1301 USA import re +import string from wb import DefineModule import grt @@ -130,29 +131,32 @@ truncated_identifier_serial = 0 class MSSQLMigration(GenericMigration): - def migrateIdentifier(self, mssql_name, log): + def migrateIdentifier(self, mssql_name, log, dots_allowed=False): mysql_valid_regex = re.compile(r'^[^/\\.]+$', re.U) # Database and table names cannot contain "/", "\", ".", or characters that are not permitted in file names mysql_name = mssql_name + log_message = '' # Remove quoting chars from the identifier if present if ( mssql_name.startswith('"') and mssql_name.endswith('"') or mssql_name.startswith('[') and mssql_name.endswith(']') ): mysql_name = mssql_name[1:-1] - if not mysql_valid_regex.match(mysql_name) and log: - entry = grt.classes.GrtLogEntry() - entry.entryType = 2 - entry.name = u'MSSQL migrateIdentifier: Could not migrate identifier %s' % mssql_name - log.entries.append(entry) + if not dots_allowed and not mysql_valid_regex.match(mysql_name): + mysql_name = mysql_name.translate(string.maketrans(r'/\.', '___')) + log_message = (u'Schema and table names cannot contain "/", "\\", ".", or characters that are ' + u'not permitted in file names. The identifier [%s] was changed to `%s`. ' % (mssql_name, mysql_name)) # truncate too long identifiers if len(mysql_name) > 64: global truncated_identifier_serial truncated_identifier_serial += 1 + original_mysql_name = mysql_name mysql_name = mysql_name[:62]+str(truncated_identifier_serial) - if log: - entry = grt.classes.GrtLogEntry() - entry.entryType = 1 - entry.name = u'Identifier `%s` is too long, truncated to `%s`' % (mssql_name, mysql_name) - log.entries.append(entry) + log_message += u'Identifier `%s` is too long, truncated to `%s`' % (original_mysql_name, mysql_name) + + if log and log_message: + entry = grt.classes.GrtLogEntry() + entry.entryType = 1 + entry.name = log_message + log.entries.append(entry) return mysql_name === modified file 'plugins/migration/frontend/migration_schema_selection.py' --- plugins/migration/frontend/migration_schema_selection.py revid:alfredo.kengi.kojima@oracle.com-20130827185054-377hmvt719gflrh9 +++ plugins/migration/frontend/migration_schema_selection.py revid:sergio.delacruz@oracle.com-20130827223754-nu3v1v6svq1fegay @@ -63,7 +63,7 @@ self.doesSupportCatalogs = self.main.plan.migrationSource.rdbms.doesSupportCatalogs if self.doesSupportCatalogs: - catalog_schemata_list = [ (catalog_name, schema_name) for catalog_name, dot, schema_name in ( full_name.partition('.') + catalog_schemata_list = [ (catalog_name, schema_name) for catalog_name, dot, schema_name in (full_name.rpartition('.') for full_name in self.main.plan.migrationSource.schemaNames) ] self.catalog_schemata = {} for catalog_name, schema_name in catalog_schemata_list: @@ -73,7 +73,7 @@ self._optionspanel.show(True) #self.advanced_button.show(True) else: - self.catalog_schemata = [ schema_name for catalog_name, dot, schema_name in (full_name.partition('.') + self.catalog_schemata = [ schema_name for catalog_name, dot, schema_name in (full_name.rpartition('.') for full_name in self.main.plan.migrationSource.schemaNames) ] self._optionspanel.show(False) #self.advanced_button.show(False)