예제 #1
0
        public static InternalSession GetSession(MySqlConnectionStringBuilder settings)
        {
            InternalSession session = new XInternalSession(settings);
            int             count   = 0;

            do
            {
                try
                {
                    session.Open();
                    SetDefaultCollation(session, settings.CharacterSet);
                    break;
                }
                catch (IOException)
                {
                    // retry ssl connection (manual fallback)
                    if (count++ >= 5)
                    {
                        throw;
                    }
                }
            } while (true);
            return(session);
        }
예제 #2
0
        public static InternalSession GetSession(MySqlXConnectionStringBuilder settings)
        {
            InternalSession session = new XInternalSession(settings);
            int             count   = 0;

            do
            {
                try
                {
                    session.Open();
                    SetDefaultCollation(session, settings.CharacterSet);
                    break;
                }
                catch (IOException ex)
                {
                    // Retry SSL connection (manual fallback).
                    if (count++ >= 5)
                    {
                        throw new MySqlException(ResourcesX.UnableToOpenSession, ex);
                    }
                }
            } while (true);
            return(session);
        }