예제 #1
0
        private void ProcessMsSQL()
        {
            try
            {
                Database origin;
                Database destination;

                if ((!String.IsNullOrEmpty(mySqlConnectFront1.DatabaseName) &&
                     (!String.IsNullOrEmpty(mySqlConnectFront2.DatabaseName))))
                {
                    Generate sql1 = new Generate();
                    Generate sql2 = new Generate();

                    sql1.ConnectionString = mySqlConnectFront1.ConnectionString;
                    sql1.Options = SqlFilter;

                    sql2.ConnectionString = mySqlConnectFront2.ConnectionString;
                    sql2.Options = SqlFilter;

                    ProgressForm progres = new ProgressForm("Reference Database", "Target Database", sql2, sql1);
                    progres.ShowDialog(this);
                    origin = progres.Source;
                    destination = progres.Destination;

                    txtDifferences.ConfigurationManager.Language = "mssql";
                    txtDifferences.IsReadOnly = false;
                    txtDifferences.Styles.LineNumber.BackColor = Color.White;
                    txtDifferences.Styles.LineNumber.IsVisible = false;
                    txtDifferences.Text = destination.ToSqlDiff().ToSQL();
                    txtDifferences.IsReadOnly = true;
                    schemaView.DatabaseSource = destination;
                    schemaView.DatabaseDestination = origin;
                    schemaView.OnSelectItem += new SchemaTreeView.SchemaHandler(schemaView_OnSelectItem);

                    btnCopy.Enabled = true;
                    btnSaveAs.Enabled = true;
                }
                else
                    MessageBox.Show(Owner, "Please select a valid connection string", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (SchemaException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new SchemaException("Invalid database connection. Please check the database connection\r\n" +
                                          ex.Message);
            }
        }
예제 #2
0
        /*private void ProcesarSybase()
        {
            DBDiff.Schema.Sybase.Model.Database origen;
            DBDiff.Schema.Sybase.Model.Database destino;

            DBDiff.Schema.Sybase.Generate sql = new DBDiff.Schema.Sybase.Generate();
            sql.ConnectioString = txtConnectionOrigen.Text;

            AseFilter.OptionFilter.FilterTrigger = false;

            origen = sql.Process(AseFilter);

            sql.ConnectioString = txtConnectionDestino.Text;
            destino = sql.Process(AseFilter);

            this.txtScript.SQLType = SQLEnum.SQLTypeEnum.Sybase;
            this.txtDiferencias.SQLType = SQLEnum.SQLTypeEnum.Sybase;
            //origen = DBDiff.Schema.Sybase.Generate.Compare(origen, destino);

            this.txtScript.Text = origen.ToSQL();
            //this.txtDiferencias.Text = origen.ToSQLDiff();
        }*/
        /*private void ProcesarMySQL()
        {
            DBDiff.Schema.MySQL.Model.Database origen;
            DBDiff.Schema.MySQL.Model.Database destino;

            DBDiff.Schema.MySQL.Generate sql = new DBDiff.Schema.MySQL.Generate();
            sql.ConnectioString = mySqlConnectFront1.ConnectionString;
            origen = sql.Process(MySQLfilter);

            sql.ConnectioString = mySqlConnectFront2.ConnectionString;
            destino = sql.Process(MySQLfilter);

            //this.txtScript.SQLType = SQLEnum.SQLTypeEnum.MySQL;
            //this.txtDiferencias.SQLType = SQLEnum.SQLTypeEnum.MySQL;
            origen = DBDiff.Schema.MySQL.Generate.Compare(origen, destino);
            this.txtDiferencias.Text = origen.ToSQLDiff();
        }
        */
        private void ProcesarSQL2005()
        {
            ProgressForm progres = null;
            string errorLocation = null;
            try
            {
                Database origen;
                Database destino;

                if ((!String.IsNullOrEmpty(mySqlConnectFront1.DatabaseName) &&
                     (!String.IsNullOrEmpty(mySqlConnectFront2.DatabaseName))))
                {
                    Generate sql1 = new Generate();
                    Generate sql2 = new Generate();

                    sql1.ConnectionString = mySqlConnectFront1.ConnectionString;
                    sql1.Options = SqlFilter;

                    sql2.ConnectionString = mySqlConnectFront2.ConnectionString;
                    sql2.Options = SqlFilter;

                    progres = new ProgressForm("Source Database", "Destination Database", sql2, sql1);
                    progres.ShowDialog(this);
                    if (progres.Error != null)
                    {
                        throw new SchemaException(progres.Error.Message, progres.Error);
                    }

                    origen = progres.Source;
                    destino = progres.Destination;

                    txtSyncScript.ConfigurationManager.Language = "mssql";
                    txtSyncScript.IsReadOnly = false;
                    txtSyncScript.Styles.LineNumber.BackColor = Color.White;
                    txtSyncScript.Styles.LineNumber.IsVisible = false;
                    errorLocation = "Generating Synchronized Script";
                    txtSyncScript.Text = destino.ToSqlDiff(_selectedSchemas).ToSQL();
                    txtSyncScript.IsReadOnly = true;
                    schemaTreeView1.DatabaseSource = destino;
                    schemaTreeView1.DatabaseDestination = origen;
                    schemaTreeView1.OnSelectItem += new SchemaTreeView.SchemaHandler(schemaTreeView1_OnSelectItem);
                    textBox1.Text = origen.ActionMessage.Message;

                    btnCopy.Enabled = true;
                    btnSaveAs.Enabled = true;
                    btnUpdateAll.Enabled = true;
                }
                else
                    MessageBox.Show(Owner, "Please select a valid connection string", "ERROR", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                if (errorLocation == null && progres != null)
                {
                    errorLocation = String.Format("{0} (while {1})", progres.ErrorLocation, progres.ErrorMostRecentProgress ?? "initializing");
                }

                throw new SchemaException("Error " + (errorLocation ?? " Comparing Databases"), ex);
            }
        }
예제 #3
0
        /*private void ProcessSybase()
         * {
         *  DBDiff.Schema.Sybase.Model.Database origin;
         *  DBDiff.Schema.Sybase.Model.Database destination;
         *
         *  DBDiff.Schema.Sybase.Generate sql = new DBDiff.Schema.Sybase.Generate();
         *  sql.ConnectioString = txtConnectionOrigen.Text;
         *
         *  AseFilter.OptionFilter.FilterTrigger = false;
         *
         *  origin = sql.Process(AseFilter);
         *
         *  sql.ConnectioString = txtConnectionDestination.Text;
         *  destination = sql.Process(AseFilter);
         *
         *  this.txtScript.SQLType = SQLEnum.SQLTypeEnum.Sybase;
         *  this.txtDiferencias.SQLType = SQLEnum.SQLTypeEnum.Sybase;
         *  //origin = DBDiff.Schema.Sybase.Generate.Compare(origin, destination);
         *
         *  this.txtScript.Text = origin.ToSQL();
         *  //this.txtDiferencias.Text = origin.ToSQLDiff();
         * }*/

        /*private void ProcessMySQL()
         * {
         *  DBDiff.Schema.MySQL.Model.Database origin;
         *  DBDiff.Schema.MySQL.Model.Database destination;
         *
         *  DBDiff.Schema.MySQL.Generate sql = new DBDiff.Schema.MySQL.Generate();
         *  sql.ConnectioString = mySqlConnectFront1.ConnectionString;
         *  origin = sql.Process(MySQLfilter);
         *
         *  sql.ConnectioString = mySqlConnectFront2.ConnectionString;
         *  destination = sql.Process(MySQLfilter);
         *
         *  //this.txtScript.SQLType = SQLEnum.SQLTypeEnum.MySQL;
         *  //this.txtDiferencias.SQLType = SQLEnum.SQLTypeEnum.MySQL;
         *  origin = DBDiff.Schema.MySQL.Generate.Compare(origin, destination);
         *  this.txtDiferencias.Text = origin.ToSQLDiff();
         * }
         */

        private void ProcessSQL2005()
        {
            ProgressForm progress      = null;
            string       errorLocation = null;

            try
            {
                Database origin;
                Database destination;

                if ((!String.IsNullOrEmpty(mySqlConnectFront1.DatabaseName) &&
                     (!String.IsNullOrEmpty(mySqlConnectFront2.DatabaseName))))
                {
                    Generate sql1 = new Generate();
                    Generate sql2 = new Generate();

                    sql1.ConnectionString = mySqlConnectFront1.ConnectionString;
                    sql1.Options          = SqlFilter;

                    sql2.ConnectionString = mySqlConnectFront2.ConnectionString;
                    sql2.Options          = SqlFilter;

                    progress = new ProgressForm("Source Database", "Destination Database", sql2, sql1);
                    progress.ShowDialog(this);
                    if (progress.Error != null)
                    {
                        throw new SchemaException(progress.Error.Message, progress.Error);
                    }

                    origin      = progress.Source;
                    destination = progress.Destination;

                    txtSyncScript.ConfigurationManager.Language = "mssql";
                    txtSyncScript.IsReadOnly = false;
                    txtSyncScript.Styles.LineNumber.BackColor = Color.White;
                    txtSyncScript.Styles.LineNumber.IsVisible = false;
                    errorLocation                       = "Generating Synchronized Script";
                    txtSyncScript.Text                  = destination.ToSqlDiff(_selectedSchemas).ToSQL();
                    txtSyncScript.IsReadOnly            = true;
                    schemaTreeView1.DatabaseSource      = destination;
                    schemaTreeView1.DatabaseDestination = origin;
                    schemaTreeView1.OnSelectItem       += new SchemaTreeView.SchemaHandler(schemaTreeView1_OnSelectItem);
                    schemaTreeView1_OnSelectItem(schemaTreeView1.SelectedNode);
                    textBox1.Text = origin.ActionMessage.Message;

                    btnCopy.Enabled      = true;
                    btnSaveAs.Enabled    = true;
                    btnUpdateAll.Enabled = true;
                }
                else
                {
                    MessageBox.Show(Owner, "Please select a valid connection string", "ERROR", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                if (errorLocation == null && progress != null)
                {
                    errorLocation = String.Format("{0} (while {1})", progress.ErrorLocation, progress.ErrorMostRecentProgress ?? "initializing");
                }

                throw new SchemaException("Error " + (errorLocation ?? " Comparing Databases"), ex);
            }
        }