Exemple #1
0
        internal int ValueInt32()
        {
            if (this.StatusValue() != DBStatus.S_OK)
            {
                throw this.CheckTypeValueStatusValue(typeof(int));
            }
            switch (this.DbType)
            {
            case 3:
                return(this.Value_I4());

            case 12:
            {
                object obj2 = this.ValueVariant();
                if (obj2 is ushort)
                {
                    return((ushort)obj2);
                }
                return((int)obj2);
            }

            case 0x12:
                return(this.Value_UI2());
            }
            throw ODB.ConversionRequired();
        }
Exemple #2
0
        internal long ValueInt64()
        {
            if (this.StatusValue() != DBStatus.S_OK)
            {
                throw this.CheckTypeValueStatusValue(typeof(long));
            }
            switch (this.DbType)
            {
            case 0x13:
                return((long)this.Value_UI4());

            case 20:
                return(this.Value_I8());

            case 12:
            {
                object obj2 = this.ValueVariant();
                if (obj2 is uint)
                {
                    return((long)((uint)obj2));
                }
                return((long)obj2);
            }
            }
            throw ODB.ConversionRequired();
        }
Exemple #3
0
        internal decimal ValueDecimal()
        {
            if (this.StatusValue() != DBStatus.S_OK)
            {
                throw this.CheckTypeValueStatusValue(typeof(short));
            }
            switch (this.DbType)
            {
            case 0x15:
                return(this.Value_UI8());

            case 0x83:
                return(this.Value_NUMERIC());

            case 12:
                return((decimal)this.ValueVariant());

            case 14:
                return(this.Value_DECIMAL());

            case 6:
                return(this.Value_CY());
            }
            throw ODB.ConversionRequired();
        }
Exemple #4
0
        internal short ValueInt16()
        {
            if (this.StatusValue() != DBStatus.S_OK)
            {
                throw this.CheckTypeValueStatusValue(typeof(short));
            }
            switch (this.DbType)
            {
            case 2:
                return(this.Value_I2());

            case 12:
            {
                object obj2 = this.ValueVariant();
                if (obj2 is sbyte)
                {
                    return((sbyte)obj2);
                }
                return((short)obj2);
            }

            case 0x10:
                return(this.Value_I1());
            }
            throw ODB.ConversionRequired();
        }
Exemple #5
0
        internal DateTime ValueDateTime()
        {
            if (this.StatusValue() != DBStatus.S_OK)
            {
                throw this.CheckTypeValueStatusValue(typeof(short));
            }
            switch (this.DbType)
            {
            case 0x85:
                return(this.Value_DBDATE());

            case 0x87:
                return(this.Value_DBTIMESTAMP());

            case 0x40:
                return(this.Value_FILETIME());

            case 7:
                return(this.Value_DATE());

            case 12:
                return((DateTime)this.ValueVariant());
            }
            throw ODB.ConversionRequired();
        }
Exemple #6
0
        internal string ValueString()
        {
            string str = (string)this._value;

            if (str != null)
            {
                return(str);
            }
            DBStatus status = this.StatusValue();

            if (status != DBStatus.S_OK)
            {
                if (status != DBStatus.S_TRUNCATED)
                {
                    throw this.CheckTypeValueStatusValue(typeof(string));
                }
            }
            else
            {
                switch (this.DbType)
                {
                case 130:
                    str = this.Value_WSTR();
                    goto Label_00C0;

                case 0x4082:
                    str = this.Value_ByRefWSTR();
                    goto Label_00C0;

                case 8:
                    str = this.Value_BSTR();
                    goto Label_00C0;

                case 12:
                    str = (string)this.ValueVariant();
                    goto Label_00C0;
                }
                throw ODB.ConversionRequired();
            }
            switch (this.DbType)
            {
            case 130:
                str = this.Value_WSTR();
                break;

            case 0x4082:
                str = this.Value_ByRefWSTR();
                break;

            default:
                throw ODB.ConversionRequired();
            }
Label_00C0:
            this._value = str;
            return(str);
        }
Exemple #7
0
 internal Guid ValueGuid()
 {
     if (this.StatusValue() != DBStatus.S_OK)
     {
         throw this.CheckTypeValueStatusValue(typeof(short));
     }
     if (this.DbType != 0x48)
     {
         throw ODB.ConversionRequired();
     }
     return(this.Value_GUID());
 }
Exemple #8
0
        internal byte[] ValueByteArray()
        {
            byte[] buffer = (byte[])this._value;
            if (buffer != null)
            {
                return(buffer);
            }
            DBStatus status = this.StatusValue();

            if (status != DBStatus.S_OK)
            {
                if (status != DBStatus.S_TRUNCATED)
                {
                    throw this.CheckTypeValueStatusValue(typeof(byte[]));
                }
            }
            else
            {
                switch (this.DbType)
                {
                case 12:
                    buffer = (byte[])this.ValueVariant();
                    goto Label_00AC;

                case 0x80:
                    buffer = this.Value_BYTES();
                    goto Label_00AC;

                case 0x4080:
                    buffer = this.Value_ByRefBYTES();
                    goto Label_00AC;
                }
                throw ODB.ConversionRequired();
            }
            switch (this.DbType)
            {
            case 0x80:
                buffer = this.Value_BYTES();
                break;

            case 0x4080:
                buffer = this.Value_ByRefBYTES();
                break;

            default:
                throw ODB.ConversionRequired();
            }
Label_00AC:
            this._value = buffer;
            return(buffer);
        }
Exemple #9
0
        internal float ValueSingle()
        {
            if (this.StatusValue() != DBStatus.S_OK)
            {
                throw this.CheckTypeValueStatusValue(typeof(float));
            }
            switch (this.DbType)
            {
            case 4:
                return(this.Value_R4());

            case 12:
                return((float)this.ValueVariant());
            }
            throw ODB.ConversionRequired();
        }
Exemple #10
0
        internal double ValueDouble()
        {
            if (this.StatusValue() != DBStatus.S_OK)
            {
                throw this.CheckTypeValueStatusValue(typeof(double));
            }
            switch (this.DbType)
            {
            case 5:
                return(this.Value_R8());

            case 12:
                return((double)this.ValueVariant());
            }
            throw ODB.ConversionRequired();
        }
Exemple #11
0
        internal bool ValueBoolean()
        {
            if (this.StatusValue() != DBStatus.S_OK)
            {
                throw this.CheckTypeValueStatusValue(typeof(bool));
            }
            switch (this.DbType)
            {
            case 11:
                return(this.Value_BOOL());

            case 12:
                return((bool)this.ValueVariant());
            }
            throw ODB.ConversionRequired();
        }
Exemple #12
0
        internal byte ValueByte()
        {
            if (this.StatusValue() != DBStatus.S_OK)
            {
                throw this.CheckTypeValueStatusValue(typeof(byte));
            }
            short dbType = this.DbType;

            if (dbType == 12)
            {
                return((byte)this.ValueVariant());
            }
            if (dbType != 0x11)
            {
                throw ODB.ConversionRequired();
            }
            return(this.Value_UI1());
        }
Exemple #13
0
        internal OleDbDataReader ValueChapter()
        {
            OleDbDataReader reader = (OleDbDataReader)this._value;

            if (reader == null)
            {
                if (this.StatusValue() != DBStatus.S_OK)
                {
                    throw this.CheckTypeValueStatusValue(typeof(string));
                }
                if (this.DbType != 0x88)
                {
                    throw ODB.ConversionRequired();
                }
                reader      = this.Value_HCHAPTER();
                this._value = reader;
            }
            return(reader);
        }