コード例 #1
0
        internal void Classify(QueriesDict dict)
        {
            foreach (var item in items)
            {
                switch (item.LoggerType)
                {
                case LoggerTypes.NamedQuery:
                    ClassifyNamedQuery(dict, item);
                    break;

                case LoggerTypes.SQL:
                    ClassifySQL(dict, item);
                    break;
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: mst72/HBMAnalyzer
        private static void ProcessLog(string queriesPath, string logPath, string logName)
        {
            var parser = new LogParser();

            parser.Load(Path.Combine(logPath, logName));
            parser.Validate();
            var dict = new QueriesDict();

            dict.Load(queriesPath);
            parser.Classify(dict);
            var ext      = Path.GetExtension(logName);
            var pureName = Path.GetFileNameWithoutExtension(logName);
            var resName  = pureName + "_decode" + ext;

            parser.Dump(Path.Combine(logPath, resName));
            //Console.ReadLine();
        }
コード例 #3
0
 private static void ClassifySQL(QueriesDict dict, LogItem item)
 {
     if (item.Operation == Operations.Invalid)
     {
         return;
     }
     //var sData = item.Value.ToString();
     if (item.LastNamedItem != null)
     {
         // possible something interesting
         //var sData2 = item.LastNamedItem.Body;
         //if (sData.StartsWith(sData2))
         //{
         item.QueryName          = item.LastNamedItem.QueryName;
         item.LastNamedItem.Hide = true;
         //}
     }
     else
     {
         //item.QueryName = dict.GetQuery(sData, item.Line);
     }
 }
コード例 #4
0
 private static void ClassifyNamedQuery(QueriesDict dict, LogItem item)
 {
     item.Body      = LogParserHelper.GetNamedQueryBody(item.Value.ToString());
     item.QueryName = dict.GetQuery(item.Body, item.Line);
 }