/// <summary> /// Main conversion function when used in GUI mode /// </summary> /// <param name="args"></param> /// <param name="inputQuery"></param> /// <param name="resultSummary"></param> /// <param name="numOfStatements"></param> /// <param name="numOfErrors"></param> /// <returns></returns> public string RunConversion(string[] args, string inputQuery, out string resultSummary, out int numOfStatements, out int numOfErrors) { Config.Initialize(args, null); ApplyLocalSettings(); if (inputQuery == null || inputQuery.Length == 0) { resultSummary = ""; numOfErrors = 0; numOfStatements = 0; return(""); } StringBuilder sb = new StringBuilder(); StringWriter writer = new StringWriter(sb); StringBuilder sbSummary = new StringBuilder(); StringWriter writerSummary = new StringWriter(sbSummary); StatusReporter.Initialize(writerSummary); numOfStatements = TranslateQueryInt(writer, inputQuery, writerSummary); writer.Close(); writerSummary.Close(); numOfErrors = 0; resultSummary = writerSummary.ToString(); return(sb.ToString()); }
/// <summary> /// Main function used when called command line mode. /// </summary> /// <param name="args"></param> /// <param name="startUI"></param> public void Run(string[] args, out bool startUI) { if (ProcessConfigFile(args, out startUI)) { return; } StatusReporter.Initialize(Console.Out); StreamWriter writer = CreateOutputFile(Config.OutputFile); String input = ReadInput(); int numOfStatements = TranslateQueryInt(writer, input, Console.Out); if (writer != null) { writer.Flush(); writer.Close(); } DbUtil.ReleaseSingleton(); }