コード例 #1
0
        /// <summary>
        /// Returns the reason why <paramref name="table"/> is not refactorable e.g. if it's name is not properly qualified
        /// with database.  Returns null if it is refactorable
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public string GetReasonNotRefactorable(ITableInfo table)
        {
            if (string.IsNullOrWhiteSpace(table.Name))
            {
                return("Table has no Name property, this should be the fully qualified database table name");
            }

            if (string.IsNullOrWhiteSpace(table.Database))
            {
                return("Table does not have it's Database property set");
            }

            //ensure database and Name match correctly
            var syntaxHelper = table.GetQuerySyntaxHelper();
            var db           = table.GetDatabaseRuntimeName(Curation.Data.DataLoad.LoadStage.PostLoad);

            if (!table.Name.StartsWith(syntaxHelper.EnsureWrapped(db)))
            {
                return(string.Format("Table with Name '{0}' has incorrect database propery '{1}'", table.Name, table.Database));
            }

            if (table.Name != table.GetFullyQualifiedName())
            {
                return(string.Format("Table name '{0}' did not match the expected fully qualified name '{1}'", table.Name, table.GetFullyQualifiedName()));
            }

            return(null);
        }
コード例 #2
0
        private void BtnRenameTableInfo_Click(object sender, EventArgs e)
        {
            var cmd = new ExecuteCommandAlterTableName(Activator, _tableInfo);

            if (cmd.IsImpossible)
            {
                MessageBox.Show(cmd.ReasonCommandImpossible);
            }
            else
            {
                cmd.Execute();
                tbTableName.Text = _tableInfo.GetFullyQualifiedName();
            }
        }
コード例 #3
0
 /// <summary>
 /// Changes the name of the <paramref name="tableInfo"/> to a new name (which must be fully qualified). This will also
 /// update any <see cref="ColumnInfo"/> and <see cref="ExtractionInformation"/> objects declared against the <paramref name="tableInfo"/>.
 ///
 /// <para>If you have transforms etc in <see cref="ExtractionInformation"/> then these may not be successfully refactored</para>
 /// </summary>
 /// <param name="tableInfo"></param>
 /// <param name="newFullyQualifiedTableName"></param>
 /// <returns>Total number of changes made in columns and table name</returns>
 public int RefactorTableName(ITableInfo tableInfo, string newFullyQualifiedTableName)
 {
     return(RefactorTableName(tableInfo, tableInfo.GetFullyQualifiedName(), newFullyQualifiedTableName));
 }