Ejemplo n.º 1
0
        public static SqlType GetDataType(int type, int collation, long precision, int scale)
        {
            if (type <= 0x19)
            {
                if (type > 12)
                {
                    if (type == 0x10)
                    {
                        return(SqlBoolean);
                    }
                    if (type == 0x19)
                    {
                        return(SqlBigint);
                    }
                }
                else
                {
                    switch (type)
                    {
                    case -11:
                        return(SqlUniqueIdentifier);

                    case -6:
                        return(Tinyint);

                    case 0:
                        return(SqlAllTypes);

                    case 1:
                    case 12:
                        goto Label_0191;

                    case 2:
                    case 3:
                        if (precision == 0)
                        {
                            precision = 0x7fffffffL;
                        }
                        return(NumberType.GetNumberType(type, precision, scale));

                    case 4:
                        return(SqlInteger);

                    case 5:
                        return(SqlSmallint);

                    case 6:
                        if (precision > 0x35L)
                        {
                            throw Error.GetError(0x15d8, precision);
                        }
                        goto Label_0175;

                    case 7:
                    case 8:
                        goto Label_0175;
                    }
                }
                goto Label_0199;
            }
            if (type <= 40)
            {
                if (type == 30)
                {
                    goto Label_00B5;
                }
                if (type == 40)
                {
                    goto Label_0191;
                }
                goto Label_0199;
            }
            if ((type - 60) > 1)
            {
                switch (type)
                {
                case 0x5b:
                case 0x5c:
                case 0x5d:
                case 0x5e:
                case 0x5f:
                    return(DateTimeType.GetDateTimeType(type, scale));

                case 100:
                    goto Label_0191;

                case 0x65:
                case 0x66:
                case 0x67:
                case 0x68:
                case 0x69:
                case 0x6a:
                case 0x6b:
                case 0x6c:
                case 0x6d:
                case 110:
                case 0x6f:
                case 0x70:
                case 0x71:
                    return(IntervalType.GetIntervalType(type, precision, scale));

                case 0x457:
                    return(Other);
                }
                goto Label_0199;
            }
Label_00B5:
            return(BinaryType.GetBinaryType(type, precision));

Label_0175:
            return(SqlDouble);

Label_0191:
            return(CharacterType.GetCharacterType(type, precision));

Label_0199:
            throw Error.RuntimeError(0xc9, "Type");
        }