Ejemplo n.º 1
0
        private static void ProcessChangeCollationCommand(string args)
        {
            IList <string> supportedCollations = _databaseOperations.GetCollationList().Select(c => c.ToLower()).ToList();
            string         collation           = args;

            if (collation == "")
            {
                Console.WriteLine("Error: Missing collation argument");
            }
            else if (supportedCollations.Contains(collation.ToLower()))
            {
                Console.WriteLine("Change of collation is started, it can take minutes, please wait");
                try
                {
                    _optimizer.ChangeCollation(collation);
                    Console.WriteLine("Change of collation was succesfully executed");
                }
                catch (Exception exc)
                {
                    Debug.WriteLine(exc);
                    Console.WriteLine($"Error: Change of collation failed with error - {exc.Message}");
                }
            }
            else
            {
                Console.WriteLine("Error: Unsupported collation, supported collations are:");
                foreach (string supportedCollation in supportedCollations)
                {
                    Console.WriteLine(supportedCollation);
                }
            }
        }