Beispiel #1
0
        public override bool Equals(object obj)
        {
            DbObject other = obj as DbObject;

            if (other == null)
            {
                return(false);
            }

            string left  = Identifier.Canonicalize(Identifier.ID);
            string right = Identifier.Canonicalize(other.Identifier.ID);

            if (!left.Equals(right))
            {
                return(false);
            }

            if (m_next != null)
            {
                DbObject tail = other.Next;
                if (tail == null)
                {
                    return(false);
                }
                else
                {
                    return(m_next.Equals(tail));
                }
            }
            else
            {
                return(!other.HasNext);
            }
        }
Beispiel #2
0
        public override void PerformBefore(DbObject node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            if (!node.HasNext)
            {
                if (TailorUtil.IsSysdate(node.Identifier))
                {
                    ReplaceTerm(node, new FunctionCall(
                                    TailorUtil.GetCapitalized(TailorUtil.NOW)));
                }

                if (!m_inSelectItems && (m_selectItemAliases != null))
                {
                    string key = Identifier.Canonicalize(node.Identifier.ID);
                    if (m_selectItemAliases.ContainsKey(key))
                    {
                        AliasedItem orig = m_selectItemAliases[key];
                        ReplaceTerm(node, orig.Item.Clone());
                    }
                }
            }

            base.PerformBefore(node);
        }
Beispiel #3
0
        public TableWildcard(DbObject dbObject)
        {
            if (dbObject == null)
            {
                throw new ArgumentNullException("dbObject");
            }

            m_dbObject = dbObject;
        }
Beispiel #4
0
        public INode Clone()
        {
            DbObject dbObject = new DbObject((Identifier)(m_identifier.Clone()));

            if (m_next != null)
            {
                dbObject.Add((DbObject)(m_next.Clone()));
            }

            return(dbObject);
        }
Beispiel #5
0
        public override void PerformAfter(DbObject node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            if (node.HasNext)
            {
                m_sql.Append('.');
            }
        }
Beispiel #6
0
        static bool IsRownumTerm(INode arg)
        {
            arg = GetComparedTerm(arg);

            DbObject dbObject = arg as DbObject;

            if ((dbObject == null) || dbObject.HasNext)
            {
                return(false);
            }

            return(IsRownum(dbObject.Identifier));
        }
Beispiel #7
0
        public override void PerformBefore(DbObject node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            if (!node.HasNext && TailorUtil.IsSysdate(node.Identifier))
            {
                ReplaceTerm(node, new FunctionCall(TailorUtil.GETDATE.ToUpperInvariant()));
            }

            base.PerformBefore(node);
        }
Beispiel #8
0
        public Assignment(DbObject name, INode val)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (val == null)
            {
                throw new ArgumentNullException("val");
            }

            m_name  = name;
            m_value = val;
        }
Beispiel #9
0
        public override void PerformBefore(DbObject node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            if (!node.HasNext && TailorUtil.IsSysdate(node.Identifier))
            {
                ReplaceTerm(node, new DbObject(new Identifier(
                                                   TailorUtil.CURRENT_TIMESTAMP.ToUpperInvariant())));
            }

            base.PerformBefore(node);
        }
Beispiel #10
0
        public void Add(DbObject tail)
        {
            if (tail == null)
            {
                throw new ArgumentNullException("tail");
            }

            if (m_next == null)
            {
                m_next = tail;
            }
            else
            {
                m_next.Add(tail);
            }
        }
Beispiel #11
0
        public override void PerformBefore(QueryExpression node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            base.PerformBefore(node);

            if (node.Where == null)
            {
                AliasedItem from = node.From;
                if ((from != null) && (from.Alias == null) && !from.HasNext)
                {
                    Table singleTable = from.Item as Table;
                    if ((singleTable != null) && (singleTable.Alias == null) &&
                        (singleTable.JoinCondition == null) &&
                        (singleTable.JoinType == null) && !singleTable.HasNext)
                    {
                        DbObject singleName = TailorUtil.GetTerm(
                            singleTable.Source) as DbObject;
                        if ((singleName != null) && !singleName.HasNext)
                        {
                            Identifier identifier = singleName.Identifier;

                            // Not canonicalizing - we're accepting quoted "dual"
                            // as a regular identifier.
                            if (TailorUtil.DUAL.Equals(
                                    identifier.ID.ToLowerInvariant()))
                            {
                                node.From = null;
                            }
                        }
                    }
                }
            }

            if (node.LimitFormat != ' ')
            {
                node.LimitFormat = 'L';
            }
        }
Beispiel #12
0
        public int CompareTo(object obj)
        {
            DbObject other = obj as DbObject;

            if (other == null)
            {
                throw new ArgumentException("Object is not a DbObject.", "obj");
            }

            string left  = Identifier.Canonicalize(Identifier.ID);
            string right = Identifier.Canonicalize(other.Identifier.ID);

            int cmp = left.CompareTo(right);

            if (cmp != 0)
            {
                return(cmp);
            }

            if (m_next != null)
            {
                DbObject tail = other.Next;
                if (tail == null)
                {
                    return(1);
                }
                else
                {
                    return(m_next.CompareTo(tail));
                }
            }
            else
            {
                return(other.HasNext ? -1 : 0);
            }
        }
Beispiel #13
0
 public virtual void PerformAfter(DbObject node)
 {
 }
Beispiel #14
0
 public virtual void PerformBefore(DbObject node)
 {
 }
Beispiel #15
0
 public override void PerformAfter(DbObject node)
 {
     PopKnownParent(node);
 }
Beispiel #16
0
 public override void PerformBefore(DbObject node)
 {
     PushParent(node);
 }