コード例 #1
0
 public unionstatement(selectstatements selects, orderbystatement orderby) : this(false, selects, orderby)
 {
 }
コード例 #2
0
 public unionstatement(bool all, selectstatements selects) : this(all, selects, null)
 {
 }
コード例 #3
0
        public new orderbystatement OrderBy; /* a good example of meaningful shadowing */

        public unionstatement(bool all, selectstatements selects, orderbystatement orderby)
        {
            All     = all;
            Selects = selects;
            OrderBy = orderby;
        }
コード例 #4
0
 public unionstatement(selectstatements selects) : this(false, selects, null)
 {
 }
コード例 #5
0
ファイル: view.cs プロジェクト: en-software-GmbH/sherm2
        public override ITable[] DependentUpon()
        {
            List <ITable> result = new List <ITable>();
            ITable        tab;
            /* a view might depend on various tables and other views, too */
            selectstatement  stmt = ConstituentSelectStatement;
            selectstatements sts;

            /* [dlatikay 20160913] pass-through views might have their dependencies specified in attributes */
            object[] da = Attribute.GetCustomAttributes(this.GetType(), typeof(DependencyAttribute), false);
            for (int i = 0; i < da.Length; ++i)
            {
                var attr = da[i] as DependencyAttribute;
                tab = TableobjectFromName(attr.Relation.Name);
                if (!result.Contains(tab))
                {
                    result.Add(tab);
                }
            }
            /* decompose possible unions */
            var unionStatement = stmt as unionstatement;

            if (unionStatement != null)
            {
                sts = unionStatement.Selects; /* a union might contain multiple selects (at least two) */
            }
            else
            {
                sts = new selectstatements()
                {
                    stmt
                }
            };                                         /* a singular statement */
            /* iterate all of them */
            foreach (selectstatement st in sts)
            {
                /* 1. look in the tables */
                if (st.Tables != null)
                {
                    foreach (tableexpression tex in st.Tables)
                    {
                        tab = TableobjectFromName(tex.Tablename);
                        if (!result.Contains(tab))
                        {
                            result.Add(tab);
                        }
                    }
                }
                /* 2. look in the joins */
                if (st.Joins != null)
                {
                    foreach (joinstatement join in st.Joins)
                    {
                        tab = TableobjectFromName(join.Tablename);
                        if (!result.Contains(tab))
                        {
                            result.Add(tab);
                        }
                    }
                }
                /* 3. look in the subqueries that might reside in the where clause */
                /* -!- not yet cared to implement */

                /* 4. look in the subqueries that might reside in the field list */
                /* -!- not yet cared to implement */
            }
            /* deliver */
            return(result.ToArray());
        }

        ITable TableobjectFromName(string name)
        {
            try
            {
                return((ITable)Assembly.GetAssembly(this.GetType()).CreateInstance("dal.schema." + name));
            }
            catch (Exception)
            {
                throw new ArgumentOutOfRangeException("name", String.Format("Failed to resolve the name \"{0}\" in the \"dal.schema\" namespace.", name));
            }
        }
    }