Beispiel #1
0
 protected override void WriteOther(OtherData o)
 {
     this.EnsureRoom((o.GetBytesLength() * 2) + 2);
     base.Write(0x27);
     StringConverter.WriteHexBytes(base.GetBuffer(), base.Count, o.GetBytes());
     base.Count += o.GetBytesLength() * 2;
     base.Write(0x27);
 }
Beispiel #2
0
        private static int GetSize(object o, SqlType type)
        {
            int num = 1;

            if (o == null)
            {
                return(num);
            }
            int typeCode = type.TypeCode;

            if (typeCode <= 30)
            {
                switch (typeCode)
                {
                case 0x10:
                    num++;
                    return(num);

                case 0x19:
                case 6:
                case 7:
                case 8:
                    return(num + 8);

                case 30:
                    goto Label_01F4;

                case -11:
                    num += 4;
                    return(num + 0x10);

                case -6:
                case 5:
                    return(num + 2);

                case 0:
                    return(num);

                case 1:
                case 12:
                    goto Label_01E0;

                case 2:
                case 3:
                    return(num + 0x10);

                case 4:
                    return(num + 4);
                }
                goto Label_01FA;
            }
            if (typeCode <= 50)
            {
                switch (typeCode)
                {
                case 40:
                    goto Label_01F4;

                case 50:
                {
                    num += 4;
                    object[] objArray = (object[])o;
                    type = type.CollectionBaseType();
                    for (int i = 0; i < objArray.Length; i++)
                    {
                        num += GetSize(objArray[i], type);
                    }
                    return(num);
                }
                }
                goto Label_01FA;
            }
            if ((typeCode - 60) <= 1)
            {
                num += 4;
                return(num + ((int)((BinaryData)o).Length(null)));
            }
            switch (typeCode)
            {
            case 0x5b:
                return(num + 8);

            case 0x5c:
                return(num + 8);

            case 0x5d:
                return(num + 12);

            case 0x5e:
                return(num + 12);

            case 0x5f:
                return(num + 0x10);

            case 0x60:
            case 0x61:
            case 0x62:
            case 0x63:
                goto Label_01FA;

            case 100:
                break;

            case 0x65:
            case 0x66:
            case 0x6b:
                return(num + 8);

            case 0x67:
            case 0x68:
            case 0x69:
            case 0x6a:
            case 0x6c:
            case 0x6d:
            case 110:
            case 0x6f:
            case 0x70:
            case 0x71:
                return(num + 12);

            default:
            {
                if (typeCode != 0x457)
                {
                    goto Label_01FA;
                }
                OtherData data = (OtherData)o;
                num += 4;
                return(num + data.GetBytesLength());
            }
            }
Label_01E0:
            num += 4;
            return(num + StringConverter.GetUtfSize((string)o));

Label_01F4:
            return(num + 8);

Label_01FA:
            throw Error.RuntimeError(0xc9, "RowOutputBinary");
        }