Example #1
0
        /// <summary>
        /// Clears the session state
        /// </summary>
        public void ClearState()
        {
            MemoryRegion.RemoveVariablesInScope(VariableType.Standard);

            if (DataInfo != null)
            {
                DataInfo.Dispose();
            }

            OverriddenSetOptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
            DataInfo = new DataSourceInfo();
            Recodes.Clear();
            Reset();
            CurrentRead = null;
            IsFirstStatement = false;
            ProgramText.Length = 0;
            DataTableRefreshNeeded = true;
            AnalysisOut = new AnalysisOutput(this);
            isCancelRequest = false;
            GroupVariableList = new Dictionary<string, List<string>>();
        }
Example #2
0
        private void Initialize()
        {
            GroupVariableList = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
            StatisticModuleList = new Dictionary<string, System.Reflection.Assembly>(StringComparer.OrdinalIgnoreCase);
            CommandToAssemblyMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
            DLLClassList = new Dictionary<string, IDLLClass>();

            foreach (string s in System.Configuration.ConfigurationSettings.AppSettings)
            {
                switch (s.ToUpper())
                {
                    case "FREQUENCY":
                    case "TABLES":
                    case "SUMMARIZE":
                    case "GRAPH":
                    case "MEANS":
                    case "MATCH":
                    case "LINEARREGRESSION":
                    case "LOGISTICREGRESSION":
                    case "COMPLEXSAMPLEMEANS":
                    case "COMPLEXSAMPLETABLES":
                    case "COMPLEXSAMPLEFREQUENCY":
                    case "KAPLANMEIERSURVIVAL":
                    case "COXPROPORTIONALHAZARDS":
                        string StatisticsAssembly = System.Configuration.ConfigurationSettings.AppSettings[s].ToString();
                        if (! StatisticModuleList.ContainsKey(StatisticsAssembly))
                        {
                            System.Reflection.Assembly a = System.Reflection.Assembly.Load(StatisticsAssembly);
                            StatisticModuleList.Add(StatisticsAssembly, a);
                        }
                        CommandToAssemblyMap.Add(s, StatisticsAssembly);
                        break;
                }
            }

            ConnectionList = new Dictionary<string, IDataSource>(StringComparer.OrdinalIgnoreCase);
            DataTableRefreshNeeded = true;
            CurrentSelect = new StringBuilder();

            PermanantVariables = new System.Collections.Specialized.NameValueCollection();
            GlobalVariables = new System.Collections.Specialized.NameValueCollection();
            StandardVariables = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

            SelectString = new StringBuilder();
            SelectExpression = new List<Epi.Core.AnalysisInterpreter.AnalysisRule>();
            SortExpression = new StringBuilder();
            DataSet = new System.Data.DataSet();
            DataInfo = new DataSourceInfo();
            ProgramText = new StringBuilder();
            IsFirstStatement = false;
            Recodes = new Dictionary<string, Epi.Core.AnalysisInterpreter.Rules.RecodeList>(StringComparer.OrdinalIgnoreCase);
            VariableExpressionList = new Dictionary<string, AnalysisRule>(StringComparer.OrdinalIgnoreCase);
            VariableValueList = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
            AnalysisOut = new AnalysisOutput(this);
            OverriddenSetOptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

            SelectCommandList.Add(CommandNames.ABS);
            SelectCommandList.Add(CommandNames.AND);
            SelectCommandList.Add(CommandNames.ALWAYS);
            SelectCommandList.Add(CommandNames.APPEND);
            SelectCommandList.Add(CommandNames.MOD);
            SelectCommandList.Add(CommandNames.LIKE);
            SelectCommandList.Add(CommandNames.OR);
            SelectCommandList.Add(CommandNames.XOR);
            SelectCommandList.Add(CommandNames.NOT);
            SelectCommandList.Add(CommandNames.EXP);
            SelectCommandList.Add(CommandNames.LN);
            SelectCommandList.Add(CommandNames.LOG);
            SelectCommandList.Add(CommandNames.NUMTODATE);
            SelectCommandList.Add(CommandNames.NUMTOTIME);
            SelectCommandList.Add(CommandNames.RECORDCOUNT);
            SelectCommandList.Add(CommandNames.RND);
            SelectCommandList.Add(CommandNames.ROUND);
            SelectCommandList.Add(CommandNames.STEP);
            SelectCommandList.Add(CommandNames.SIN);
            SelectCommandList.Add(CommandNames.COS);
            SelectCommandList.Add(CommandNames.TAN);
            SelectCommandList.Add(CommandNames.TRUNC);
            SelectCommandList.Add(CommandNames.PFROMZ);
            SelectCommandList.Add(CommandNames.ZSCORE);
            SelectCommandList.Add(CommandNames.YEARS);
            SelectCommandList.Add(CommandNames.MONTHS);
            SelectCommandList.Add(CommandNames.DAYS);
            SelectCommandList.Add(CommandNames.YEAR);
            SelectCommandList.Add(CommandNames.MONTH);
            SelectCommandList.Add(CommandNames.DAY);
            SelectCommandList.Add(CommandNames.CURRENTUSER);
            SelectCommandList.Add(CommandNames.EXISTS);
            SelectCommandList.Add(CommandNames.FILEDATE);
            SelectCommandList.Add(CommandNames.SYSTEMDATE);
            SelectCommandList.Add(CommandNames.SYSTEMTIME);
            SelectCommandList.Add(CommandNames.HOURS);
            SelectCommandList.Add(CommandNames.MINUTES);
            SelectCommandList.Add(CommandNames.SECONDS);
            SelectCommandList.Add(CommandNames.HOUR);
            SelectCommandList.Add(CommandNames.MINUTE);
            SelectCommandList.Add(CommandNames.SECOND);
            SelectCommandList.Add(CommandNames.FINDTEXT);
            SelectCommandList.Add(CommandNames.FORMAT);
            SelectCommandList.Add(CommandNames.LINEBREAK);
            SelectCommandList.Add(CommandNames.STRLEN);
            SelectCommandList.Add(CommandNames.SUBSTRING);
            SelectCommandList.Add(CommandNames.TXTTONUM);
            SelectCommandList.Add(CommandNames.TXTTODATE);
            SelectCommandList.Add(CommandNames.UPPERCASE);
        }