Beispiel #1
0
        /// <summary>
        /// Compares all the supplied table definitions.
        /// </summary>
        /// <param name="sourceTables"></param>
        /// <param name="destinationTables"></param>
        private void CompareAllTables(DataTable sourceTables, DataTable destinationTables, DatabaseComparison comparison)
        {
            // Verify source tables
            foreach(DataRow row in sourceTables.Rows) {
                // Fetch information about source table
                string tabname = (string)row["TABLE_NAME"];
                Debug.WriteLine("Retrieving table information for " + tabname);
                DataSet ds = _sourceDbService.GetTableInfo(tabname);
                TableDescriptor sourceTable = new TableDescriptor(ds);

                // Lookup destination table
                TableComparison tablecomparison;
                DataRow[] desttabs = destinationTables.Select(string.Format("TABLE_NAME='{0}'", tabname));
                if(desttabs.Length > 0) {
                    // Table exists in destination, retrieve more info and compare them
                    ds = _destinationDbService.GetTableInfo(tabname);
                    TableDescriptor destinationTable = new TableDescriptor(ds);
                    FilterMatches(sourceTable, destinationTable);

                    // Create comparison result
                    tablecomparison = new TableComparison(tabname, sourceTable, destinationTable);
                }
                else {
                    // Create comparison result (destination table is missing)
                    tablecomparison = new TableComparison(tabname, sourceTable, null);
                }

                // Add comparison result and fire event
                comparison.TableComparisons.Add(tablecomparison);
                EventManager.OnTableComparisonComplete(tablecomparison);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Adds a table comparison object to the collection.
 /// </summary>
 /// <param name="tablecomparison"></param>
 internal void Add(TableComparison tablecomparison)
 {
     _list.Add(tablecomparison);
 }
Beispiel #3
0
        /// <summary>
        /// This occurs when verifying databases.
        /// </summary>
        private void EventManager_TableComparisonComplete(TableComparison comparison)
        {
            _progressdialog.TotalText = string.Format("Table '{0}' compared.", comparison.TableName);
            _progressdialog.TotalProgress.Value++;
            UpdateProgressPercent();

            if (comparison.SourceTable == null)
                return; // We only show source tables in the list

            // Find item to update
            GLItem item = FindDatabaseListItem(comparison.TableName);
            if (item == null)
                return;

            // Update item with information about the comparison
            item.Checked = comparison.IsEqual;
            item.Tag = comparison;
            item.SubItems[(int) DatabaseListColumns.Summary].Text = comparison.Summary;
            ProgressBar pb = (ProgressBar) item.SubItems[(int) DatabaseListColumns.Progress].Control;
            pb.Value = 100;

            if (!comparison.IsEqual) {
                item.ForeColor = Color.Red;
            }
            _databaselist.Refresh();
            CheckDeployAbort();
            Application.DoEvents();
        }