Beispiel #1
0
        void SetDataRow(
            DataRow dr,
            QueryTable qt,
            MetaBrokerStats mbs)
        {
            string txt;
            int    i1 = -1;

            bool searchStep    = (qt == null);
            bool retrievalStep = (qt != null);

            if (searchStep)             // search step
            {
                try
                {
                    string[] sa = mbs.Label.Split(':');

                    dr["MetatableLabel"] = sa[0];                    // search substep
                    dr["MetatableName"]  = sa[1];                    // one or more tables

                    int.TryParse(sa[2], out i1);
                    if (i1 >= 0)
                    {
                        dr["ColumnCount"] = i1;
                    }

                    int.TryParse(sa[3], out i1);
                    if (i1 >= 0)
                    {
                        dr["ColumnsSelected"] = i1;
                    }

                    int.TryParse(sa[4], out i1);
                    if (i1 >= 0)
                    {
                        dr["CriteriaCount"] = i1;
                    }

                    dr["BrokerCol"] = Lex.Replace(sa[5], "Broker", "");                     // remove any Broker suffix
                }

                catch (Exception ex) { return; }
            }

            else             // retrieval step
            {
                dr["MetatableLabel"] = qt.ActiveLabel;
                dr["MetatableName"]  = qt.MetaTable.Name;

                dr["ColumnCount"]     = qt.VisibleColumnCount;             // includes Selected_or_Criteria_or_GroupBy_or_Sorted
                dr["ColumnsSelected"] = qt.SelectedCount;
                dr["CriteriaCount"]   = qt.GetCriteriaCount(true, false);

                txt             = qt.MetaTable.MetaBrokerType.ToString();
                dr["BrokerCol"] = Lex.Replace(txt, "Broker", "");                 // remove any Broker suffix
            }

            if (mbs != null)
            {
                if (mbs.MultiPivot <= 0)
                {
                    dr["Multipivot"] = "";
                }
                else if (mbs.MultiPivot == 1)
                {
                    dr["Multipivot"] = "1";
                }
                else if (mbs.MultiPivot == 2)
                {
                    dr["Multipivot"] = "2";
                }
                else
                {
                    dr["Multipivot"] = "?";
                }

                if (mbs.MetatableRowCount >= 0)
                {
                    dr["NextRowCount"] = mbs.MetatableRowCount;
                    if (retrievalStep)
                    {
                        MetatableTotalRows += mbs.MetatableRowCount;
                    }
                }
                else
                {
                    dr["NextRowCount"] = DBNull.Value;
                }

                if (mbs.OracleRowCount >= 0)
                {
                    dr["ReadRowCount"] = mbs.OracleRowCount;
                    if (retrievalStep)
                    {
                        OracleTotalRows += mbs.OracleRowCount;
                    }
                }
                else
                {
                    dr["ReadRowCount"] = DBNull.Value;
                }

                if (mbs.Time > 0)
                {
                    dr["OracleTime"] = mbs.Time / 1000.0;                     // store fractional seconds as double
                }
                else
                {
                    dr["OracleTime"] = DBNull.Value;
                }
            }

            return;
        }