public override void HandleRequest(string jsonString, AjaxBase ajax)
        {
            CheckMySqlSettingRequest request = Utility.ParseJson<CheckMySqlSettingRequest>(jsonString);

            MySqlConnection connection = null;
            bool pass = false;
            try
            {
                connection = Database.GetConnection(
                    request.server,
                    request.port,
                    request.username,
                    request.password,
                    request.database);

                new MySqlCommand(String.Format("SHOW FULL TABLES FROM `{0}`", MySqlHelper.EscapeString(request.database)), connection).ExecuteReader().Close();

                pass = true;
            }
            catch (Exception)
            {
            }

            if (connection != null)
            {
                connection.Close();
            }

            CheckMySqlSettingResponse response = new CheckMySqlSettingResponse();
            response.pass = pass;

            ajax.ReturnJson(response);
        }
Beispiel #2
0
 private void MysqlCheckSuccess(CheckMySqlSettingResponse response)
 {
     MySqlSettingChecking = false;
     MySqlSettingOkay = response.pass;
     if (!response.pass)
     {
         MySqlCheckFailed();
     }
 }