Esempio n. 1
0
 protected override void WriteArray(object[] o, SqlType type)
 {
     type = type.CollectionBaseType();
     this.WriteInt(o.Length);
     for (int i = 0; i < o.Length; i++)
     {
         base.WriteData(type, o[i]);
     }
 }
Esempio n. 2
0
        protected override object[] ReadArray(SqlType type)
        {
            type = type.CollectionBaseType();
            int num = this.ReadInt();

            object[] objArray = new object[num];
            for (int i = 0; i < num; i++)
            {
                objArray[i] = base.ReadData(type);
            }
            return(objArray);
        }
Esempio n. 3
0
 protected override void WriteArray(object[] o, SqlType type)
 {
     type = type.CollectionBaseType();
     this._noSeparators = true;
     base.Write(BytesArray);
     for (int i = 0; i < o.Length; i++)
     {
         if (i > 0)
         {
             base.Write(0x2c);
         }
         base.WriteData(type, o[i]);
     }
     base.Write(0x5d);
     this._noSeparators = false;
 }
Esempio n. 4
0
        protected override object[] ReadArray(SqlType type)
        {
            type = type.CollectionBaseType();
            this.ReadFieldPrefix();
            this._scanner.ScanNext();
            string str = this._scanner.GetString();

            this._value = null;
            if (str.Equals("NULL", StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }
            if (!str.Equals("ARRAY", StringComparison.OrdinalIgnoreCase))
            {
                throw Error.GetError(0x15d0);
            }
            this._scanner.ScanNext();
            if (!this._scanner.GetString().Equals("[", StringComparison.OrdinalIgnoreCase))
            {
                throw Error.GetError(0x15d0);
            }
            List <object> list = new List <object>();

            this._noSeparators = true;
            for (int i = 0; !this._scanner.ScanSpecialIdentifier("]"); i++)
            {
                if ((i > 0) && !this._scanner.ScanSpecialIdentifier(","))
                {
                    throw Error.GetError(0x15d0);
                }
                object item = base.ReadData(type);
                list.Add(item);
            }
            this._noSeparators = false;
            return(list.ToArray());
        }
Esempio n. 5
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");
        }