예제 #1
0
        /// <summary>
        /// Initialize the set of global brokers
        /// </summary>

        public static void InitializeGlobalBrokers()
        {
            Array brokerList = Enum.GetValues(typeof(MetaBrokerType));
            int   maxBroker  = 0;
            bool  b;

            foreach (int enumValue in brokerList)
            {
                if (enumValue > maxBroker)
                {
                    maxBroker = enumValue;
                }
            }
            GlobalBrokers = new IMetaBroker[maxBroker + 1];
            foreach (int enumValue in brokerList)
            {
                if (enumValue == (int)MetaBrokerType.Unknown)
                {
                    continue;
                }
                GlobalBrokers[enumValue] = MetaBrokerUtil.Create((MetaBrokerType)enumValue);
                if (enumValue > maxBroker)
                {
                    maxBroker = enumValue;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Build the sql for a query
        /// </summary>
        /// <param name="eqp">ExecuteQueryParms</param>
        /// <returns>Sql for the query</returns>

        public override string BuildSql(
            ExecuteQueryParms eqp)
        {
            string     sql = "";
            MetaColumn mc;

            List <MetaBrokerType> MbTypes =            // metabrokers that can provide unpivoted assay data
                                            new List <MetaBrokerType>();

            MbTypes.Add(MetaBrokerType.Assay);

            Eqp   = eqp;
            Qt    = eqp.QueryTable;
            Exprs = FromClause = OrderBy = "";             // outer sql elements
            KeyMc = Mt.KeyMetaColumn;

            SelectList = new List <MetaColumn>();            // build list of selected metacolumns
            foreach (QueryColumn qc in Qt.QueryColumns)
            {
                mc = qc.MetaColumn;
                if (qc.Selected)
                {
                    SelectList.Add(mc);
                }
            }

            foreach (MetaBrokerType mbt in MbTypes)             // get Sql for each broker and union together
            {
                IMetaBroker mb = MetaBrokerUtil.Create(mbt);
                if (mb == null)
                {
                    throw new Exception("Unrecognized Metabroker: " + mbt);
                }
                string sql2 = mb.BuildUnpivotedAssayResultsSql(eqp);

                //if (actBinAQc != null)
                //  sql2 = Lex.Replace(sql2, "null activity_bin", ActivityBinSqlExpression + " activity_bin");

                if (Lex.IsDefined(sql))
                {
                    sql += " union all ";
                }
                sql += "/*** MetaBrokerType." + mbt.ToString() + " ***/ " + sql2;
            }

            sql = " select * from ( " + sql + " ) ";
            if (Qt.Alias != "")
            {
                sql += " " + Qt.Alias;
            }
            if (eqp.CallerSuppliedCriteria != "")
            {
                sql += " where " + eqp.CallerSuppliedCriteria;
            }

            return(sql);
        }