public override byte[] GetSlice(int sliceLength) { int[] statusVector = ExtConnection.GetNewStatusVector(); int dbHandle = this.db.Handle; int trHandle = this.transaction.Handle; ArrayDescMarshaler marshaler = ArrayDescMarshaler.Instance; IntPtr arrayDesc = marshaler.MarshalManagedToNative(this.Descriptor); byte[] buffer = new byte[sliceLength]; SafeNativeMethods.isc_array_get_slice( statusVector, ref dbHandle, ref trHandle, ref this.handle, arrayDesc, buffer, ref sliceLength); // Free memory marshaler.CleanUpNativeData(ref arrayDesc); ExtConnection.ParseStatusVector(statusVector); return(buffer); }
public override byte[] GetSlice(int sliceLength) { ClearStatusVector(); var dbHandle = _db.HandlePtr; var trHandle = _transaction.HandlePtr; var arrayDesc = ArrayDescMarshaler.MarshalManagedToNative(Descriptor); var buffer = new byte[sliceLength]; _db.FbClient.isc_array_get_slice( _statusVector, ref dbHandle, ref trHandle, ref _handle, arrayDesc, buffer, ref sliceLength); ArrayDescMarshaler.CleanUpNativeData(ref arrayDesc); _db.ProcessStatusVector(_statusVector); return(buffer); }
public override void PutSlice(Array sourceArray, int sliceLength) { ClearStatusVector(); var dbHandle = _db.HandlePtr; var trHandle = _transaction.HandlePtr; var arrayDesc = ArrayDescMarshaler.MarshalManagedToNative(Descriptor); var systemType = GetSystemType(); var buffer = new byte[sliceLength]; if (systemType.GetTypeInfo().IsPrimitive) { Buffer.BlockCopy(sourceArray, 0, buffer, 0, buffer.Length); } else { buffer = EncodeSlice(Descriptor, sourceArray, sliceLength); } _db.FbClient.isc_array_put_slice( _statusVector, ref dbHandle, ref trHandle, ref _handle, arrayDesc, buffer, ref sliceLength); ArrayDescMarshaler.CleanUpNativeData(ref arrayDesc); _db.ProcessStatusVector(_statusVector); }
public override byte[] GetSlice(int sliceLength) { // Clear the status vector ClearStatusVector(); int dbHandle = _db.Handle; int trHandle = _transaction.Handle; ArrayDescMarshaler marshaler = ArrayDescMarshaler.Instance; IntPtr arrayDesc = marshaler.MarshalManagedToNative(Descriptor); byte[] buffer = new byte[sliceLength]; _db.FbClient.isc_array_get_slice( _statusVector, ref dbHandle, ref trHandle, ref _handle, arrayDesc, buffer, ref sliceLength); // Free memory marshaler.CleanUpNativeData(ref arrayDesc); FesConnection.ParseStatusVector(_statusVector, _db.Charset); return(buffer); }
public override byte[] GetSlice(int sliceLength) { // Clear the status vector ClearStatusVector(); DatabaseHandle dbHandle = _db.HandlePtr; TransactionHandle trHandle = _transaction.HandlePtr; IntPtr arrayDesc = ArrayDescMarshaler.MarshalManagedToNative(Descriptor); byte[] buffer = new byte[sliceLength]; _db.FbClient.isc_array_get_slice( _statusVector, ref dbHandle, ref trHandle, ref _handle, arrayDesc, buffer, ref sliceLength); // Free memory ArrayDescMarshaler.CleanUpNativeData(ref arrayDesc); _db.ProcessStatusVector(_statusVector); return(buffer); }
public override ValueTask <byte[]> GetSliceAsync(int sliceLength, CancellationToken cancellationToken = default) { ClearStatusVector(); var dbHandle = _db.HandlePtr; var trHandle = _transaction.HandlePtr; var arrayDesc = ArrayDescMarshaler.MarshalManagedToNative(Descriptor); var buffer = new byte[sliceLength]; _db.FbClient.isc_array_get_slice( _statusVector, ref dbHandle, ref trHandle, ref _handle, arrayDesc, buffer, ref sliceLength); ArrayDescMarshaler.CleanUpNativeData(ref arrayDesc); _db.ProcessStatusVector(_statusVector); return(ValueTask2.FromResult(buffer)); }
public override void PutSlice(System.Array sourceArray, int sliceLength) { // Clear the status vector ClearStatusVector(); DatabaseHandle dbHandle = _db.HandlePtr; TransactionHandle trHandle = _transaction.HandlePtr; IntPtr arrayDesc = ArrayDescMarshaler.MarshalManagedToNative(Descriptor); // Obtain the System of type of Array elements and // Fill buffer Type systemType = GetSystemType(); byte[] buffer = new byte[sliceLength]; #if NET40 if (systemType.IsPrimitive) #else if (systemType.GetTypeInfo().IsPrimitive) #endif { Buffer.BlockCopy(sourceArray, 0, buffer, 0, buffer.Length); } else { buffer = EncodeSlice(Descriptor, sourceArray, sliceLength); } _db.FbClient.isc_array_put_slice( _statusVector, ref dbHandle, ref trHandle, ref _handle, arrayDesc, buffer, ref sliceLength); // Free memory ArrayDescMarshaler.CleanUpNativeData(ref arrayDesc); _db.ProcessStatusVector(_statusVector); }
public override void PutSlice(System.Array sourceArray, int sliceLength) { // Clear the status vector ClearStatusVector(); int dbHandle = _db.Handle; int trHandle = _transaction.Handle; ArrayDescMarshaler marshaler = ArrayDescMarshaler.Instance; IntPtr arrayDesc = marshaler.MarshalManagedToNative(Descriptor); // Obtain the System of type of Array elements and // Fill buffer Type systemType = GetSystemType(); byte[] buffer = new byte[sliceLength]; if (systemType.IsPrimitive) { Buffer.BlockCopy(sourceArray, 0, buffer, 0, buffer.Length); } else { buffer = EncodeSlice(Descriptor, sourceArray, sliceLength); } _db.FbClient.isc_array_put_slice( _statusVector, ref dbHandle, ref trHandle, ref _handle, arrayDesc, buffer, ref sliceLength); // Free memory marshaler.CleanUpNativeData(ref arrayDesc); FesConnection.ParseStatusVector(_statusVector, _db.Charset); }
public override void PutSlice(System.Array sourceArray, int sliceLength) { int[] statusVector = ExtConnection.GetNewStatusVector(); int dbHandle = this.db.Handle; int trHandle = this.transaction.Handle; ArrayDescMarshaler marshaler = ArrayDescMarshaler.Instance; 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); } SafeNativeMethods.isc_array_put_slice( statusVector, ref dbHandle, ref trHandle, ref this.handle, arrayDesc, buffer, ref sliceLength); // Free memory marshaler.CleanUpNativeData(ref arrayDesc); ExtConnection.ParseStatusVector(statusVector); }