If you like this, buy me some beer!

UnSQL For MySQL

Welcome to UnSQL For MySQL !

How to setup:

  1. Open Your project first.
  2. Add UnSQL.dll (Choose what type of database) to your reference.
  3. Add "using UnSQL.MySQL" to your C# files or "Import UnSQL.Mysql" in VB.NET

How to use:
  • Install MySQL
        private void btnInstall_Click(object sender, EventArgs e)
        {
            var iController = new Controller();
            iController.InstallComplete += iController_installcomplete;

            //It is the easy method:

            iController.Install(Application.StartupPath + "\\db\\");

            //If you want more setting options:

            Install(Application.StartupPath + "\\db\\",
            Controller.ServerType.Dedicated_MySQL_Server,
            Controller.ApproNum.OLTP,9998,Controller.CharSet.gbk);
        }

        private void iController_installcomplete()
        {
            MessageBox.Show("INSTALL Database Completed!");
        }

        //The definition of Install function is like this:

        /// <summary>
        ///   Install Mysql X86/X64 will auto detected and install.
        /// </summary>
        /// <param name="iPath"> The path you want to install </param>
        /// <param name="iType"> Database Mechine Type, Developer is
        ///   enough for most of using</param>
        /// <param name="iNum"> OLAP/OLTP </param>
        /// <param name="iPort"> Listening port </param>
        /// <param name="iChar"> character-set-server </param>


///////////////////////////////////////////////////////////////////////////////////
        //Param definition

        #region ApproNum enum

        public enum ApproNum
        {
            OLAP,
            OLTP
        }

        #endregion

        #region CharSet enum

        public enum CharSet
        {
            Latin1,
            utf8,
            big5,
            gbk
        }

        #endregion

        #region ServerType enum

        public enum ServerType
        {
            //This will effect to CPU and memory usage.
            Developer,
            Server,
            Dedicated_MySQL_Server
        }

        #endregion

///////////////////////////////////////////////////////////////////////////////////

//Notice: If you don't know what these are, do not make any change, just keep it simple

  • Start MySQL
        private void btnStart_Click(object sender, EventArgs e)
        {
            var iController = new Controller();
            iController.StartComplete += iController _RunComplete;
            
            //You need to use the path where you installed the Database
            iController.StartService(Application.StartupPath + "\\db\\");
        }

        private void iController_RunComplete()
        {
            MessageBox.Show("Database Started!");
        }

  • Stop MySQL
        private void btnStop_Click(object sender, EventArgs e)
        {
            var iController = new Controller();
            iController.StopComplete += iController_StopComplete;

            //You need use database path and database port.
            //If you didn't change at the install section, it should be "9998"
            iController.StopService(Application.StartupPath + "\\db\\", "9998");
        }

        private void iController_StopComplete()
        {
            MessageBox.Show("Database Stopped");
        }

Last edited Jun 14, 2012 at 11:35 AM by K9998, version 1

Comments

No comments yet.