Esempio n. 1
0
        private void RunQueryToOutputFile()
        {
            HqlOutFile outfile = new HqlOutFile(_settings.OutputFilename);

            for (; ;)
            {
                if (!GetLine())
                {
                    break;
                }
                outfile.WriteLine(_line);
            }
            outfile.Close();
        }
Esempio n. 2
0
        private void RunQueryToOutputCategorize()
        {
            Dictionary <HqlKey, HqlOutFile> dic = null;

            try
            {
                // have a hash table of the open filenames, when I get 25 open, close them all
                dic = new Dictionary <HqlKey, HqlOutFile>();
                int openedFiles = 0;
                for (; ;)
                {
                    if (openedFiles > 125)
                    {
                        CloseAllFiles(dic);
                        openedFiles = 0;
                    }
                    if (!GetLine())
                    {
                        break;
                    }

                    // due to windows being case-insensitive, I am forcing to uppercase when inside my dictionary.
                    //string upperCaseFilename = _outfilename.ToUpper();
                    HqlKey key = new HqlKey(new string[] { _outfilename.ToUpper() });
                    if (dic.ContainsKey(key))
                    {
                        if (!dic[key].IsOpen)
                        {
                            openedFiles++;
                        }
                    }
                    else
                    {
                        dic[key] = new HqlOutFile(_outfilename);
                        openedFiles++;
                    }
                    dic[key].WriteLine(_line);
                }
            }
            finally
            {
                CloseAllFiles(dic);
            }
        }