public override string GenerateConnectionString(bool includepwd)
        {
            if (TunnelDriver == null)
            {
                return("");
            }
            var pars = new TunnelConnectionStringBuilder();

            TunnelDriver.SaveConnectionParams(pars);
            SaveConnectionParams(pars);
            string res = pars.ConnectionString;

            if (!includepwd)
            {
                res = Logging.MangleConnectionString_RemovePassword(res);
            }
            return(res);
        }
Esempio n. 2
0
 public override string GenerateConnectionString(bool includepwd)
 {
     if (TunnelDriver != null)
     {
         var pars = new TunnelConnectionStringBuilder();
         TunnelDriver.SaveConnectionParams(pars);
         pars.Login    = Login;
         pars.Password = Password;
         pars.Port     = Port;
         pars.Host     = DataSource;
         pars.Engine   = "mysql";
         if (DatabaseMode == ConnectionDatabaseMode.Explicit)
         {
             pars.InitialDatabase = ExplicitDatabaseName;
         }
         return(pars.ConnectionString);
     }
     else
     {
         string res = String.Format("Data Source={0};User ID={1};Password={2}", DataSource, Login, includepwd ? Password : "******");
         if (DatabaseMode == ConnectionDatabaseMode.Explicit)
         {
             res += ";Database=" + ExplicitDatabaseName;
         }
         if (Port > 0 && Port != 3306)
         {
             res += ";Port=" + Port.ToString();
         }
         if (CharacterSet != null)
         {
             res += ";Character Set=" + CharacterSet.WebName.Replace("-", "");
         }
         res += ";Allow Zero Datetime=Yes";
         res += ";Allow User Variables=true";
         res += ";Persist Security Info=true";
         res += ";Default Command Timeout=3600";
         return(res);
     }
 }