Ejemplo n.º 1
0
        public override SqlType GetAggregateType(SqlType other)
        {
            if (base.TypeCode == other.TypeCode)
            {
                if (base.Precision < other.Precision)
                {
                    return(other);
                }
                return(this);
            }
            if (other.IsCharacterType())
            {
                return(other.GetAggregateType(this));
            }
            switch (other.TypeCode)
            {
            case 30:
                if (other.Precision < base.Precision)
                {
                    return(GetBinaryType(other.TypeCode, base.Precision));
                }
                return(other);

            case 60:
                if (base.Precision < other.Precision)
                {
                    return(GetBinaryType(base.TypeCode, other.Precision));
                }
                return(this);

            case 0x3d:
                if (base.TypeCode != 30)
                {
                    if (other.Precision < base.Precision)
                    {
                        return(GetBinaryType(other.TypeCode, base.Precision));
                    }
                    return(other);
                }
                if (base.Precision < other.Precision)
                {
                    return(GetBinaryType(base.TypeCode, other.Precision));
                }
                return(this);

            case -11:
                if (base.Precision < 0x10L)
                {
                    return(GetBinaryType(base.TypeCode, 0x10L));
                }
                return(this);

            case 0:
                return(this);
            }
            throw Error.GetError(0x15ba);
        }
Ejemplo n.º 2
0
 public override SqlType GetAggregateType(SqlType other)
 {
     if (base.TypeCode == other.TypeCode)
     {
         return(this);
     }
     if (!other.IsCharacterType() && !other.IsNumberType())
     {
         throw Error.GetError(0x15ba);
     }
     return(other.GetAggregateType(this));
 }
Ejemplo n.º 3
0
        public override SqlType GetAggregateType(SqlType other)
        {
            SqlType type3;

            if (base.TypeCode == other.TypeCode)
            {
                if ((base.Precision >= other.Precision) && (base.Scale >= other.Scale))
                {
                    return(this);
                }
                if ((base.Precision <= other.Precision) && (base.Scale <= other.Scale))
                {
                    return(other);
                }
            }
            if (other == SqlType.SqlAllTypes)
            {
                return(this);
            }
            if (other.IsCharacterType())
            {
                return(other.GetAggregateType(this));
            }
            if (!other.IsIntervalType())
            {
                throw Error.GetError(0x15ba);
            }
            IntervalType type2                = (IntervalType)other;
            int          startType            = (type2.StartIntervalType > base.StartIntervalType) ? base.StartIntervalType : type2.StartIntervalType;
            int          endType              = (type2.EndIntervalType > base.EndIntervalType) ? type2.EndIntervalType : base.EndIntervalType;
            int          combinedIntervalType = GetCombinedIntervalType(startType, endType);
            long         precision            = (base.Precision > other.Precision) ? base.Precision : other.Precision;
            int          fractionPrecision    = (base.Scale > other.Scale) ? base.Scale : other.Scale;

            try
            {
                type3 = GetIntervalType(combinedIntervalType, startType, endType, precision, fractionPrecision, false);
            }
            catch (Exception)
            {
                throw Error.GetError(0x15ba);
            }
            return(type3);
        }
Ejemplo n.º 4
0
        public override SqlType GetAggregateType(SqlType other)
        {
            int num2;

            if (base.TypeCode == other.TypeCode)
            {
                if (base.Scale < other.Scale)
                {
                    return(other);
                }
                return(this);
            }
            if (other.TypeCode == 0)
            {
                return(this);
            }
            if (other.IsCharacterType())
            {
                return(other.GetAggregateType(this));
            }
            if (!other.IsDateTimeType())
            {
                throw Error.GetError(0x15ba);
            }
            DateTimeType type2 = (DateTimeType)other;

            if ((type2.StartIntervalType > base.EndIntervalType) || (base.StartIntervalType > type2.EndIntervalType))
            {
                throw Error.GetError(0x15ba);
            }
            int  scale = (base.Scale > type2.Scale) ? base.Scale : type2.Scale;
            bool flag  = this._withTimeZone || type2._withTimeZone;

            if (((type2.StartIntervalType > base.StartIntervalType) ? base.StartIntervalType : type2.StartIntervalType) == 0x68)
            {
                num2 = flag ? 0x5e : 0x5c;
            }
            else
            {
                num2 = flag ? 0x5f : 0x5d;
            }
            return(GetDateTimeType(num2, scale));
        }