Exemple #1
0
        /// <summary>Will only convert to MyISAM if default storage engine set to MyISAM.</summary>
        private void butToMyIsam_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will convert all tables in the database to the MyISAM storage engine.  This may take several minutes.\r\nContinue?"))
            {
                return;
            }
            if (InnoDb.GetDefaultEngine() == "InnoDB")
            {
                MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(
                    Lan.g("FormInnoDB", "You will first need to change your default storage engine to MyISAM.  Make sure that the following line is in your my.ini file: \r\n"
                          + "default-storage-engine=MyISAM.\r\n"
                          + "Then, restart the MySQL service and return here."));
                msgbox.ShowDialog();
                return;
            }
            if (!Shared.MakeABackup(BackupLocation.InnoDbTool))
            {
                return;                //A message has already shown that the backup failed.
            }
            Cursor         = Cursors.WaitCursor;
            textBox1.Text += Lans.g("FormInnoDb", "Default Storage Engine: " + InnoDb.GetDefaultEngine().ToString() + "\r\n");
            Application.DoEvents();
            int numchanged = InnoDb.ConvertTables("InnoDB", "MyISAM");

            textBox1.Text += Lan.g("FormInnoDb", "Number of tables converted to MyISAM: ") + numchanged.ToString() + "\r\n";
            Application.DoEvents();
            textBox1.Text += InnoDb.GetEngineCount();
            Application.DoEvents();
            Cursor = Cursors.Default;
        }
Exemple #2
0
        private void FormInnoDb_Load(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            StringBuilder strB = new StringBuilder();

            strB.Append('-', 60);
            textBox1.Text = DateTime.Now.ToString() + strB.ToString() + "\r\n";
            Application.DoEvents();
            textBox1.Text += Lans.g("FormInnoDb", "Default Storage Engine: " + InnoDb.GetDefaultEngine().ToString() + "\r\n");
            Application.DoEvents();
            textBox1.Text += InnoDb.GetEngineCount();
            Application.DoEvents();
            Cursor = Cursors.Default;
        }
Exemple #3
0
        /// <summary>Will only convert to InnoDB if default storage engine set to InnoDB and skip-innodb is not in my.ini file, which disables InnoDB engine.</summary>
        private void butToInnoDb_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will convert all tables in the database to the InnoDB storage engine.  This may take several minutes.\r\nContinue?"))
            {
                return;
            }
            if (!InnoDb.IsInnodbAvail())
            {
                MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(
                    Lan.g("FormInnoDb", "InnoDB storage engine is disabled.  In order for InnoDB tables to work you must comment out the skip-innodb line in your my.ini file, like this:\r\n"
                          + "#skip-innodb\r\n"
                          + "and, if present, comment out the default-storage-engine line like this: \r\n"
                          + "#default-storage-engine=MyISAM.\r\n"
                          + "Then, restart the MySQL service and return here."));
                msgbox.ShowDialog();
                return;
            }
            if (InnoDb.GetDefaultEngine() == "MyISAM")
            {
                MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(
                    Lan.g("FormInnoDB", "You will first need to change your default storage engine to InnoDB.  In your my.ini file, comment out the default-storage-engine line like this: \r\n"
                          + "#default-storage-engine=MyISAM.\r\n"
                          + "Then, restart the MySQL service and return here."));
                msgbox.ShowDialog();
                return;
            }
            try {
                MiscData.MakeABackup();
            }
            catch (Exception ex) {
                if (ex.Message != "")
                {
                    MessageBox.Show(ex.Message);
                }
                MsgBox.Show("FormInnoDb", "Backup failed. Your database has not been altered.");
                return;
            }
            Cursor         = Cursors.WaitCursor;
            textBox1.Text += Lans.g("FormInnoDb", "Default Storage Engine: " + InnoDb.GetDefaultEngine().ToString() + "\r\n");
            Application.DoEvents();
            int numchanged = InnoDb.ConvertTables("MyISAM", "InnoDB");

            textBox1.Text += Lan.g("FormInnoDb", "Number of tables converted to InnoDB: ") + numchanged.ToString() + "\r\n";
            Application.DoEvents();
            textBox1.Text += InnoDb.GetEngineCount();
            Application.DoEvents();
            Cursor = Cursors.Default;
        }