Exemple #1
0
        public void InitializeBatch()
        {
            #region Argument exceptions

            if (ExecutionMode != ProcedureExecutionMode.Batch)
            {
                throw new ApplicationException("Invalid executuion mode [{0}]".FormatWith(ExecutionMode));
            }

            #endregion

            BatchHelper.Initialize(this);
        }
Exemple #2
0
        public void TraceBatchException(Exception exception)
        {
            #region Argument exceptions

            if (ExecutionMode != ProcedureExecutionMode.Batch)
            {
                throw new ApplicationException("Invalid executuion mode [{0}]".FormatWith(ExecutionMode));
            }

            #endregion

            BatchHelper.TraceException(this, exception);
        }
Exemple #3
0
        private ProcedureContext(ProcedureExecutionMode executionMode, string statement, ClearCacheMode clearCacheMode, int queryResultRowLimit = 0, string clientVersion = null, string clientType = null, string batchID = null, string batchConnectionString = null, string batchName = null)
        {
            #region Argument exception

            if (statement == null)
            {
                throw new ArgumentNullException("statement");
            }

            if (executionMode == ProcedureExecutionMode.Batch ^ batchID != null)
            {
                throw new ArgumentException("ExecutionMode XOR batchID");
            }

            if (executionMode == ProcedureExecutionMode.Batch ^ batchConnectionString != null)
            {
                throw new ArgumentException("ExecutionMode XOR BatchConnectionString");
            }

            #endregion

            _batchConnectionString = batchConnectionString;
            _cancellationSource    = new CancellationTokenSource();

            Statement                 = statement;
            ExecutionMode             = executionMode;
            BatchID                   = Guid.Parse(batchID ?? Guid.Empty.ToString());
            ExecutionID               = Guid.NewGuid();
            BatchName                 = batchName;
            CubeName                  = statement.GetCubeName();
            QueryResultRowLimit       = queryResultRowLimit;
            DatabaseName              = AdomdServer.Context.CurrentDatabaseName;
            ConnectionUserName        = AdomdServer.Context.CurrentConnection.User.Name;
            ImpersonationIdentity     = WindowsIdentity.GetCurrent();
            ExecuteForPrepare         = AdomdServer.Context.ExecuteForPrepare;
            CurrentTraceEvents        = ProfilerCollector.CurrentTraceEvents();
            ASQAServerVersion         = GetAsqaServerVersion().ToString();
            ASQAServerConfig          = GetRawConfiguration();
            ClientVersion             = clientVersion;
            ClientType                = clientType;
            SystemPhysicalMemory      = PInvokeHelper.GetPhysicalSystemMemory();
            SystemOperativeSystemName = PInvokeHelper.GetOperatingSystemName();
            SystemLogicalCpuCore      = Environment.ProcessorCount;

            GetConfigurationDetails(out int configuredTraceEventsThreshold, out ClearCacheMode configuredClearCacheMode);
            TraceEventsThreshold = configuredTraceEventsThreshold;
            ClearCacheMode       = clearCacheMode == ClearCacheMode.Default ? configuredClearCacheMode : clearCacheMode;

            var ssasInfo = GetServerInfo();
            SSASInstanceName    = AdomdServer.Context.CurrentServerID;
            SSASInstanceVersion = ssasInfo.Item1;
            SSASInstanceEdition = ssasInfo.Item2;
            SSASInstanceConfig  = ssasInfo.Item3;

            if (executionMode == ProcedureExecutionMode.Batch)
            {
                var sqlInfo = BatchHelper.GetServerInfo(this);
                SQLInstanceName    = sqlInfo.Item1;
                SQLInstanceVersion = sqlInfo.Item2;
                SQLInstanceEdition = sqlInfo.Item3;

                CheckBatchVersionCompatibility(version: sqlInfo.Item4);
            }

            CubeMetadata = XmlaHelper.RetrieveCubeMetadata(this);
            ProcedureContext.CheckVersionCompatibility(SSASInstanceVersion);
        }