예제 #1
0
파일: Program.cs 프로젝트: getsqldata/AzSQL
 private static void parserTester(string input)
 {
     Console.WriteLine("{0}", input);
     try
     {
         AzSQLParseTree parseTree = AzSQL.ParseAzSQL(input);
         Console.WriteLine("{0}", parseTree.filterCondition.ToString());
     }
     catch (AzSQLParseException ex)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Syntax Eror at line {0}, position {1}: {2}", ex.line, ex.charPosition, ex.Message);
         Console.ResetColor();
     }
     catch (Exception ex)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Exception {0}: {1}", ex.GetType().FullName, ex.Message);
         Console.ResetColor();
     }
     finally
     {
         Console.WriteLine("----------------------");
         Console.WriteLine();
     }
 }
예제 #2
0
파일: Program.cs 프로젝트: getsqldata/AzSQL
        private static void E2ETester(string input, StorageCredentials creds)
        {
            Console.WriteLine("{0}", input);
            IEnumerable <DynamicTableEntity> results = AzSQL.RunQuery(input, creds);

            AzTableQuery.RenderResults(results);
            Console.WriteLine("----------------------");
            Console.WriteLine();
        }
예제 #3
0
파일: Program.cs 프로젝트: getsqldata/AzSQL
        private static void repl()    // R-E-P-Loop
        {
            StorageCredentials creds = new StorageCredentials(acctName, acctKey);
            string             input;
            string             prompt = "> ";

            Console.Write("{0}", prompt); input = Console.ReadLine();
            while (input.ToLower() != "quit" && input.ToLower() != "exit")
            {
                if (input.Trim() != "")
                {
                    try
                    {
                        IEnumerable <DynamicTableEntity> results = AzSQL.RunQuery(input, creds);
                        AzTableQuery.RenderResults(results);
                    }
                    catch (AzSQLParseException ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Syntax Eror at line {0}, position {1}: {2}", ex.line, ex.charPosition, ex.Message);
                        Console.ResetColor();
                    }
                    catch (Exception ex)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Exception {0}: {1}", ex.GetType().FullName, ex.Message);
                        Console.ResetColor();
                    }
                    finally
                    {
                        Console.WriteLine();
                    }
                }
                Console.Write("{0}", prompt); input = Console.ReadLine();
            }
        }