Exemplo n.º 1
0
        public static Driver Create(MySqlConnectionStringBuilder settings)
        {
            Driver driver = null;

            try
            {
                if (MySqlTrace.QueryAnalysisEnabled || settings.Logging || settings.UseUsageAdvisor)
                {
                    driver = new TracingDriver(settings);
                }
            }
            catch (TypeInitializationException ex)
            {
                if (!(ex.InnerException is SecurityException))
                {
                    throw ex;
                }
            }
            if (driver == null)
            {
                driver = new Driver(settings);
            }
            driver.Open();
            return(driver);
        }
Exemplo n.º 2
0
        public static Driver Create(MySqlConnectionStringBuilder settings)
        {
            Driver d = null;

#if !CF
            try
            {
                if (MySqlTrace.QueryAnalysisEnabled || settings.Logging || settings.UseUsageAdvisor)
                {
                    d = new TracingDriver(settings);
                }
            }
            catch (TypeInitializationException ex)
            {
                if (!(ex.InnerException is SecurityException))
                {
                    throw ex;
                }
                //Only rethrow if InnerException is not a SecurityException. If it is a SecurityException then
                //we couldn't initialize MySqlTrace because we don't have unmanaged code permissions.
            }
#endif
            if (d == null)
            {
                d = new Driver(settings);
            }

            d.Open();
            return(d);
        }
Exemplo n.º 3
0
        public static Driver Create(MySqlConnectionStringBuilder settings)
        {
            Driver d = null;

#if !CF
            if (settings.Logging || settings.UseUsageAdvisor || MySqlTrace.QueryAnalysisEnabled)
            {
                d = new TracingDriver(settings);
            }
            else
#endif
            d = new Driver(settings);
            d.Open();
            return(d);
        }
Exemplo n.º 4
0
        public static Driver Create(MySqlConnectionStringBuilder settings)
        {
            Driver d = null;

#if !CF && !RT
            try
            {
                if (MySqlTrace.QueryAnalysisEnabled || settings.Logging || settings.UseUsageAdvisor)
                {
                    d = new TracingDriver(settings);
                }
            }
            catch (TypeInitializationException ex)
            {
                if (!(ex.InnerException is SecurityException))
                {
                    throw ex;
                }
                //Only rethrow if InnerException is not a SecurityException. If it is a SecurityException then
                //we couldn't initialize MySqlTrace because we don't have unmanaged code permissions.
            }
#else
            if (settings.Logging || settings.UseUsageAdvisor)
            {
                throw new NotImplementedException("Logging not supported in this WinRT release.");
            }
#endif
            if (d == null)
            {
                d = new Driver(settings);
            }

            //this try was added as suggested fix submitted on MySql Bug 72025, socket connections are left in CLOSE_WAIT status when connector fails to open a new connection.
            //the bug is present when the client try to get more connections that the server support or has configured in the max_connections variable.
            try
            {
                d.Open();
            }
            catch
            {
                d.Dispose();
                throw;
            }
            return(d);
        }
Exemplo n.º 5
0
        public static Driver Create(MySqlConnectionStringBuilder settings)
        {
            Driver d = null;
#if !CF
            try
            {
                if (MySqlTrace.QueryAnalysisEnabled || settings.Logging || settings.UseUsageAdvisor)
                    d = new TracingDriver(settings);
            }
            catch (TypeInitializationException ex)
            {
                if (!(ex.InnerException is SecurityException))
                    throw ex;
                //Only rethrow if InnerException is not a SecurityException. If it is a SecurityException then 
                //we couldn't initialize MySqlTrace because we don't have unmanaged code permissions. 
            }
#endif
            if ( d == null )
                d = new Driver(settings);

            d.Open();
            return d;
        }
Exemplo n.º 6
0
    public static Driver Create(MySqlConnectionStringBuilder settings)
    {
      Driver d = null;
#if !CF && !RT
      try
      {
        if (MySqlTrace.QueryAnalysisEnabled || settings.Logging || settings.UseUsageAdvisor)
          d = new TracingDriver(settings);
      }
      catch (TypeInitializationException ex)
      {
        if (!(ex.InnerException is SecurityException))
          throw ex;
        //Only rethrow if InnerException is not a SecurityException. If it is a SecurityException then 
        //we couldn't initialize MySqlTrace because we don't have unmanaged code permissions. 
      }
#else
      if (settings.Logging || settings.UseUsageAdvisor)
      {
        throw new NotImplementedException( "Logging not supported in this WinRT release." );
      }
#endif
      if (d == null)
        d = new Driver(settings);

      //this try was added as suggested fix submitted on MySql Bug 72025, socket connections are left in CLOSE_WAIT status when connector fails to open a new connection.
      //the bug is present when the client try to get more connections that the server support or has configured in the max_connections variable.
      try
      {
        d.Open();
      }
      catch
      {
        d.Dispose();
        throw;
      }
      return d;
    }
Exemplo n.º 7
0
        public static Driver Create(MySqlConnectionStringBuilder settings)
        {
            Driver d = null;

            #if !CF
            if (settings.Logging || settings.UseUsageAdvisor)
                d = new TracingDriver(settings);
            else
            #endif
                d = new Driver(settings);
            d.Open();
            return d;
        }