Example #1
0
        public virtual string GetPlanForQuery(string query)
        {
            IList<ParseError> errors;
            var fragment = new TSql120Parser(false).Parse(new StringReader(query), out errors );
            var visitor = new ProcedureVisitor();
            fragment.Accept(visitor);

            foreach (var proc in visitor.Procedures)
            {
                var procName = proc.ProcedureReference.Name;
                return GetPlanForProc(procName);
            }
            foreach (var func in visitor.Functions)
            {
                var procName = func.Name;
                return GetPlanForFunc(procName, func.Parameters);
            }



            return "";
        }
Example #2
0
        public virtual string GetPlanForQuery(string query)
        {
            IList <ParseError> errors;
            var fragment = VersionDetector.ParserFactory(false).Parse(new StringReader(query), out errors);
            var visitor  = new ProcedureVisitor();

            fragment.Accept(visitor);

            foreach (var proc in visitor.Procedures)
            {
                var procName = proc.ProcedureReference.Name;
                return(GetPlanForProc(procName));
            }
            foreach (var func in visitor.Functions)
            {
                var procName = func.Name;
                return(GetPlanForFunc(procName, func.Parameters));
            }



            return("");
        }