Пример #1
0
        public override byte[] GetSlice(int sliceLength)
        {
            int[] statusVector = FesConnection.GetNewStatusVector();

            int dbHandle = this.db.Handle;
            int trHandle = this.transaction.Handle;

            ArrayDescMarshaler marshaler = ArrayDescMarshaler.GetInstance();

            IntPtr arrayDesc = marshaler.MarshalManagedToNative(this.Descriptor);

            byte[] buffer = new     byte[sliceLength];

            FbClient.isc_array_get_slice(
                statusVector,
                ref dbHandle,
                ref trHandle,
                ref this.handle,
                arrayDesc,
                buffer,
                ref sliceLength);

            // Free	memory
            marshaler.CleanUpNativeData(ref arrayDesc);

            FesConnection.ParseStatusVector(statusVector);

            return(buffer);
        }
Пример #2
0
        public static ArrayDescMarshaler GetInstance()
        {
            if (ArrayDescMarshaler.instance == null)
            {
                ArrayDescMarshaler.instance = new ArrayDescMarshaler();
            }

            return(ArrayDescMarshaler.instance);
        }
		public static ArrayDescMarshaler GetInstance()
		{
			if (ArrayDescMarshaler.instance == null)
			{
				ArrayDescMarshaler.instance = new ArrayDescMarshaler();
			}

			return ArrayDescMarshaler.instance;
		}
Пример #4
0
        public override void PutSlice(System.Array sourceArray, int sliceLength)
        {
            int[] statusVector = FesConnection.GetNewStatusVector();

            int dbHandle = this.db.Handle;
            int trHandle = this.transaction.Handle;

            ArrayDescMarshaler marshaler = ArrayDescMarshaler.GetInstance();

            IntPtr arrayDesc = marshaler.MarshalManagedToNative(this.Descriptor);

            // Obtain the System of	type of	Array elements and
            // Fill	buffer
            Type systemType = this.GetSystemType();

            byte[] buffer = new     byte[sliceLength];
            if (systemType.IsPrimitive)
            {
                Buffer.BlockCopy(sourceArray, 0, buffer, 0, buffer.Length);
            }
            else
            {
                buffer = this.EncodeSlice(this.Descriptor, sourceArray, sliceLength);
            }

            FbClient.isc_array_put_slice(
                statusVector,
                ref dbHandle,
                ref trHandle,
                ref this.handle,
                arrayDesc,
                buffer,
                ref sliceLength);

            // Free	memory
            marshaler.CleanUpNativeData(ref arrayDesc);

            FesConnection.ParseStatusVector(statusVector);
        }