Exemplo n.º 1
0
        /// <include file='doc\OracleLob.uex' path='docs/doc[@for="OracleLob.SetLength"]/*' />
        public override void SetLength(long value)
        {
            AssertObjectNotDisposed();

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

            AssertConnectionIsOpen();
            AssertAmountIsValid(value, "value");

            AssertTransactionExists();

            EnsureBuffering(false);

            UInt32 newlength = (UInt32)AdjustOffsetToOracle(value);

            int rc = TracedNativeMethods.OCILobTrim(
                ServiceContextHandle,
                ErrorHandle,
                Descriptor,
                newlength
                );

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

            // Adjust the current position to be within the length of the lob, if
            // we just truncated it before the current position.
            _currentPosition = Math.Min(_currentPosition, value);
        }
        public override void SetLength(long value)
        {
            this.AssertObjectNotDisposed();
            if (this.IsNull)
            {
                throw System.Data.Common.ADP.LobWriteInvalidOnNull();
            }
            this.AssertConnectionIsOpen();
            this.AssertAmountIsValid(value, "value");
            this.AssertTransactionExists();
            uint newlen = (uint)this.AdjustOffsetToOracle(value);
            int  rc     = TracedNativeMethods.OCILobTrim(this.ServiceContextHandle, this.ErrorHandle, this.Descriptor, newlen);

            if (rc != 0)
            {
                this.Connection.CheckError(this.ErrorHandle, rc);
            }
            this._currentPosition = Math.Min(this._currentPosition, value);
        }