Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <example>
 /// call ASQA.Reconfigure("<config />");
 /// </example>
 public static void Reconfigure(string xconfig)
 {
     using (ProcedureMutex.TryAcquire())
     {
         EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureReconfigureBegin);
         ProcedureContext.Reconfigure(xconfig);
         EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureReconfigureEnd);
     }
 }
Beispiel #2
0
 /// <summary>
 ///
 /// </summary>
 /// <example>
 /// call ASQA.Uninstall();
 /// </example>
 public static void Uninstall()
 {
     using (ProcedureMutex.TryAcquire())
     {
         EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureUninstallBegin);
         ProfilerCollector.Uninstall();
         EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureUninstallEnd);
     }
 }
Beispiel #3
0
        public static DataSet Analyze(string statement, int clearCacheMode, int queryResultRowLimit, string clientVersion, string clientType)
        {
            using (ProcedureMutex.TryAcquire())
            {
                EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureAnalyzeBegin);

                DataSet procedureResult;
                using (var procedureContext = ProcedureContext.CreateForLiveExecution(statement, (ClearCacheMode)clearCacheMode, queryResultRowLimit, clientVersion, clientType))
                    using (var analyzeResult = new AnalyzerResult(procedureContext))
                    {
                        if (AdomdServer.Context.ExecuteForPrepare)
                        {
                            procedureResult = analyzeResult.CalculateForPrepare();
                        }
                        else
                        {
                            procedureContext.ValidateStatement();
                            procedureContext.ClearCache();
                            procedureContext.LoadCubeScript();

                            AdomdServer.Context.CheckCancelled();

                            using (var analyzeTask = AnalyzerTask.StartAsync(procedureContext))
                            {
                                #region Pending outcome

                                while (!analyzeTask.Wait(100))
                                {
                                    try
                                    {
                                        AdomdServer.Context.CheckCancelled();
                                    }
                                    catch (AdomdServer.AdomdException)
                                    {
                                        procedureContext.Cancel();

                                        while (!analyzeTask.IsCompleted)
                                        {
                                            Thread.Sleep(50);
                                        }

                                        throw;
                                    }
                                }

                                #endregion

                                procedureResult = analyzeResult.Calculate(analyzeTask.Result);
                            }
                        }
                    }

                EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureAnalyzeEnd);
                return(procedureResult);
            }
        }
Beispiel #4
0
 /// <summary>
 ///
 /// </summary>
 /// <example>call ASQA.GetConfiguration(configurationType);</example>
 public static DataTable GetConfiguration(int configurationType)
 {
     using (ProcedureMutex.TryAcquire())
     {
         EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureGetConfigurationBegin);
         var configuration = ProcedureContext.GetConfigurationFor((ConfigurationType)configurationType);
         EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureGetConfigurationEnd);
         return(configuration);
     }
 }
Beispiel #5
0
        public static DataSet AnalyzeBatch(string statement, int clearCacheMode, string batchID, string batchConnectionString, string clientVersion, string clientType, string batchName, bool throwOnError)
        {
            using (ProcedureMutex.TryAcquire())
            {
                EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureAnalyzeBegin);

                var procedureResult = new DataSet();
                using (var procedureContext = ProcedureContext.CreateForBatchExecution(statement, (ClearCacheMode)clearCacheMode, batchID, batchConnectionString, clientVersion, clientType, batchName))
                    using (var analyzeResult = new AnalyzerResult(procedureContext))
                    {
                        AdomdServer.Context.CheckCancelled();

                        BatchHelper.Initialize(procedureContext);
                        try
                        {
                            procedureContext.ValidateStatement();
                            procedureContext.ClearCache();
                            procedureContext.LoadCubeScript();

                            AdomdServer.Context.CheckCancelled();

                            using (var analyzeTask = AnalyzerTask.StartAsync(procedureContext))
                            {
                                #region Pending outcome

                                while (!analyzeTask.Wait(100))
                                {
                                    try
                                    {
                                        AdomdServer.Context.CheckCancelled();
                                    }
                                    catch (AdomdServer.AdomdException)
                                    {
                                        procedureContext.Cancel();

                                        while (!analyzeTask.IsCompleted)
                                        {
                                            Thread.Sleep(50);
                                        }

                                        throw;
                                    }
                                }

                                #endregion

                                procedureResult = analyzeResult.Calculate(analyzeTask.Result);
                            }

                            BatchHelper.Finalize(procedureContext);
                        }
                        catch (Exception ex)
                        {
                            BatchHelper.TraceException(procedureContext, ex);

                            if (throwOnError)
                            {
                                throw ex;
                            }
                        }
                    }

                EventsNotifier.Instance.Notify(ProcedureEvents.ProcedureAnalyzeEnd);
                return(procedureResult);
            }
        }