Beispiel #1
0
        void ISqlConsole.Execute(string command)
        {
            string       line   = null;
            StringReader reader = new StringReader(command);

            while ((line = reader.ReadLine()) != null)
            {
                Console.WriteLine(this._currentLineNumber + "> " + line);
                if (!this.ProcessConsoleEntry(line))
                {
                    this.QuitConsole = true;
                    return;
                }
                if (ConsoleHandler.IsLogOpen)
                {
                    try
                    {
                        ConsoleHandler.FlushLog();
                        continue;
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
            this._currentLineNumber = 1L;
            this.CommandBuffer.Clear();
        }
Beispiel #2
0
 internal void Run(string commandFile, Dictionary <string, string> variables)
 {
     this.EnsureInitialized();
     try
     {
         if (string.IsNullOrEmpty(commandFile))
         {
             string str;
             Console.WriteLine("");
             Console.WriteLine("Console mode. Type 'help' for more information.");
             this.QuitConsole = false;
             do
             {
                 Console.Write(this._currentLineNumber + "> ");
                 str = Console.ReadLine();
                 if ((str == null) || !this.ProcessConsoleEntry(str))
                 {
                     return;
                 }
                 if (ConsoleHandler.IsLogOpen)
                 {
                     try
                     {
                         ConsoleHandler.FlushLog();
                     }
                     catch
                     {
                     }
                 }
             }while ((str != null) && !this.QuitConsole);
         }
         else
         {
             this.PlayCommandFile(commandFile, this._connection, variables);
         }
     }
     finally
     {
         try
         {
             this._connection.Close();
         }
         catch
         {
         }
     }
 }