public long Erase(long offset, long amount)
        {
            this.AssertObjectNotDisposed();
            if (this.IsNull)
            {
                throw System.Data.Common.ADP.LobWriteInvalidOnNull();
            }
            this.AssertAmountIsValid(amount, "amount");
            this.AssertAmountIsEven(offset, "offset");
            this.AssertPositionIsValid();
            this.AssertConnectionIsOpen();
            this.AssertTransactionExists();
            if ((offset < 0L) || (offset >= 0xffffffffL))
            {
                return(0L);
            }
            uint num4 = (uint)this.AdjustOffsetToOracle(amount);
            uint num3 = ((uint)this.AdjustOffsetToOracle(offset)) + 1;
            int  rc   = TracedNativeMethods.OCILobErase(this.ServiceContextHandle, this.ErrorHandle, this.Descriptor, ref num4, num3);

            if (rc != 0)
            {
                this.Connection.CheckError(this.ErrorHandle, rc);
            }
            return(this.AdjustOracleToOffset((long)num4));
        }
Exemplo n.º 2
0
        /// <include file='doc\OracleLob.uex' path='docs/doc[@for="OracleLob.Erase2"]/*' />
        public long Erase(
            long offset,
            long amount
            )
        {
            AssertObjectNotDisposed();

            if (IsNull)
            {
                throw ADP.LobWriteInvalidOnNull();
            }

            AssertAmountIsValid(amount, "amount");
            AssertAmountIsEven(offset, "offset");

            AssertPositionIsValid();

            AssertConnectionIsOpen();
            AssertTransactionExists();

            if (offset < 0 || offset >= (long)UInt32.MaxValue)                          // MDAC 82575
            {
                return(0);
            }


            UInt32 eraseAmount = (UInt32)AdjustOffsetToOracle(amount);
            UInt32 eraseOffset = (UInt32)AdjustOffsetToOracle(offset) + 1;                      // Oracle is 1 based, we are zero based.

            EnsureBuffering(false);

            // Erase (zero or space fill) bytes from the specified offset
            int rc = TracedNativeMethods.OCILobErase(
                ServiceContextHandle,
                ErrorHandle,
                Descriptor,
                ref eraseAmount,
                eraseOffset
                );

            if (0 != rc)
            {
                Connection.CheckError(ErrorHandle, rc);
            }

            long bytesErased = AdjustOracleToOffset(eraseAmount);

            return(bytesErased);
        }