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); }
private void ParseStatusVector(int[] statusVector) { IscException ex = FesConnection.ParseStatusVector(statusVector); if (ex != null && !ex.IsWarning) { throw ex; } }
protected override void Cancel() { lock (this.db) { int[] statusVector = FesConnection.GetNewStatusVector(); FbClient.isc_cancel_blob(statusVector, ref this.blobHandle); FesConnection.ParseStatusVector(statusVector); } }
protected override void PutSegment(byte[] buffer) { lock (this.db) { int[] statusVector = FesConnection.GetNewStatusVector(); FbClient.isc_put_segment( statusVector, ref this.blobHandle, (short)buffer.Length, buffer); FesConnection.ParseStatusVector(statusVector); } }
internal void ParseStatusVector(int[] statusVector) { IscException ex = FesConnection.ParseStatusVector(statusVector); if (ex != null) { if (ex.IsWarning) { this.warningMessage(ex); } else { throw ex; } } }
public void Detach() { lock (this) { if (this.TransactionCount > 0) { throw new IscException(IscCodes.isc_open_trans, this.TransactionCount); } int[] statusVector = FesConnection.GetNewStatusVector(); int dbHandle = this.Handle; FbClient.isc_detach_database(statusVector, ref dbHandle); this.handle = dbHandle; FesConnection.ParseStatusVector(statusVector); } }
protected override void Open() { lock (this.db) { int[] statusVector = FesConnection.GetNewStatusVector(); int dbHandle = this.db.Handle; int trHandle = this.transaction.Handle; FbClient.isc_open_blob2( statusVector, ref dbHandle, ref trHandle, ref this.blobHandle, ref this.blobId, 0, new byte[0]); FesConnection.ParseStatusVector(statusVector); } }
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); }
protected override void Create() { lock (this.db) { int[] statusVector = FesConnection.GetNewStatusVector(); int dbHandle = this.db.Handle; int trHandle = this.transaction.Handle; FbClient.isc_create_blob2( statusVector, ref dbHandle, ref trHandle, ref this.blobHandle, ref this.blobId, 0, new byte[0]); FesConnection.ParseStatusVector(statusVector); this.RblAddValue(IscCodes.RBL_create); } }