Exemple #1
0
        internal SLQuery Clone()
        {
            SLQuery q = new SLQuery();

            q.Mdx       = this.Mdx;
            q.HasTuples = this.HasTuples;
            q.Tuples    = this.Tuples.Clone();

            return(q);
        }
        internal void FromTupleCache(TupleCache tc)
        {
            this.SetAllNull();

            // I decided to do this one by one instead of just running through all the child
            // elements. Mainly because this seems safer... so complicated! It's just a pivot table
            // for goodness sakes...

            if (tc.Entries != null)
            {
                this.Entries.FromEntries(tc.Entries);
                this.HasEntries = true;
            }

            if (tc.Sets != null)
            {
                SLTupleSet ts;
                using (OpenXmlReader oxr = OpenXmlReader.Create(tc.Sets))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(TupleSet))
                        {
                            ts = new SLTupleSet();
                            ts.FromTupleSet((TupleSet)oxr.LoadCurrentElement());
                            this.Sets.Add(ts);
                        }
                    }
                }
            }

            if (tc.QueryCache != null)
            {
                SLQuery q;
                using (OpenXmlReader oxr = OpenXmlReader.Create(tc.QueryCache))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(Query))
                        {
                            q = new SLQuery();
                            q.FromQuery((Query)oxr.LoadCurrentElement());
                            this.QueryCache.Add(q);
                        }
                    }
                }
            }

            if (tc.ServerFormats != null)
            {
                SLServerFormat sf;
                using (OpenXmlReader oxr = OpenXmlReader.Create(tc.ServerFormats))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(ServerFormat))
                        {
                            sf = new SLServerFormat();
                            sf.FromServerFormat((ServerFormat)oxr.LoadCurrentElement());
                            this.ServerFormats.Add(sf);
                        }
                    }
                }
            }
        }