コード例 #1
0
ファイル: PrefL.cs プロジェクト: nampn/ODental
        ///<summary>This ONLY runs when first opening the program.  Gets run early in the sequence. Returns false if the program should exit.</summary>
        public static bool CheckMySqlVersion()
        {
            if (DataConnection.DBtype != DatabaseType.MySql)
            {
                return(true);
            }
            string thisVersion  = MiscData.GetMySqlVersion();
            float  floatVersion = PIn.Float(thisVersion.Substring(0, 3));

            if (floatVersion < 5.0f)
            {
                //We will force users to upgrade to 5.0, but not yet to 5.5
                MessageBox.Show(Lan.g("Prefs", "Your version of MySQL won't work with this program") + ": " + thisVersion
                                + ".  " + Lan.g("Prefs", "You should upgrade to MySQL 5.0 using the installer on our website."));
                Application.Exit();
                return(false);
            }
            if (!PrefC.ContainsKey("MySqlVersion"))             //db has not yet been updated to store this pref
            //We're going to skip this.  We will recommend that people first upgrade OD, then MySQL, so this won't be an issue.
            {
            }
            else if (Prefs.UpdateString(PrefName.MySqlVersion, floatVersion.ToString("f1")))
            {
                if (!MsgBox.Show("Prefs", MsgBoxButtons.OKCancel, "Tables will now be optimized.  This will take a minute or two."))
                {
                    Application.Exit();
                    return(false);
                }
                DatabaseMaintenance.RepairAndOptimize();
            }
            if (PrefC.ContainsKey("DatabaseConvertedForMySql41"))
            {
                return(true);               //already converted
            }
            if (!MsgBox.Show("Prefs", true, "Your database will now be converted for use with MySQL 4.1."))
            {
                Application.Exit();
                return(false);
            }
            //ClassConvertDatabase CCD=new ClassConvertDatabase();
            try {
                MiscData.MakeABackup();
            }
            catch (Exception e) {
                if (e.Message != "")
                {
                    MessageBox.Show(e.Message);
                }
                MsgBox.Show("Prefs", "Backup failed. Your database has not been altered.");
                Application.Exit();
                return(false);               //but this should never happen
            }
            MessageBox.Show("Backup performed");
            Prefs.ConvertToMySqlVersion41();
            MessageBox.Show("converted");
            //Refresh();
            return(true);
        }
コード例 #2
0
ファイル: FormTestLatency.cs プロジェクト: kjb7749/testImport
        private void butLatency_Click(object sender, EventArgs e)
        {
            Stopwatch watch = new Stopwatch();

            Cursor = Cursors.WaitCursor;
            watch.Start();
            MiscData.GetMySqlVersion();            //a nice short query and small dataset.
            watch.Stop();
            textLatency.Text = watch.ElapsedMilliseconds.ToString();
            Cursor           = Cursors.Default;
        }
コード例 #3
0
ファイル: FormTestLatency.cs プロジェクト: kjb7749/testImport
        private void butSpeed_Click(object sender, EventArgs e)
        {
            Stopwatch watch = new Stopwatch();

            Cursor = Cursors.WaitCursor;
            watch.Start();
            MiscData.GetMySqlVersion();            //a nice short query and small dataset.
            watch.Stop();
            long latency = watch.ElapsedMilliseconds;

            watch.Restart();
            Prefs.RefreshCache();
            watch.Stop();
            long speed = watch.ElapsedMilliseconds - latency;

            textSpeed.Text = speed.ToString();
            Cursor         = Cursors.Default;
        }
コード例 #4
0
ファイル: PrefL.cs プロジェクト: nampn/ODental
        ///<summary>This runs when first opening the program.  If MySql is not at 5.5 or higher, it reminds the user, but does not force them to upgrade.</summary>
        public static void MySqlVersion55Remind()
        {
            if (DataConnection.DBtype != DatabaseType.MySql)
            {
                return;
            }
            string thisVersion  = MiscData.GetMySqlVersion();
            float  floatVersion = PIn.Float(thisVersion.Substring(0, 3));

            //doing it this way will be needed later to handle two digit version numbers.
            //We may then combine them into a single float, remembering to left pad single digit minor versions.
            //int majVer=int.Parse(thisVersion.Split(',','.')[0]);
            //int minVer=int.Parse(thisVersion.Split(',','.')[1]);
            //if((majVer<5 || (majVer=5 && minVer<5))	&& !Programs.IsEnabled(ProgramName.eClinicalWorks)){//Do not show msg if MySQL version is 5.5 or greater or eCW is enabled
            if (floatVersion < 5.5f && !Programs.IsEnabled(ProgramName.eClinicalWorks))             //Do not show msg if MySQL version is 5.5 or greater or eCW is enabled
            {
                MsgBox.Show("Prefs", "You should upgrade to MySQL 5.5 using the installer posted on our website.  It's not urgent, but until you upgrade, you are likely to get a few errors each day which will require restarting the MySQL service.");
            }
        }