Esempio n. 1
0
        /// <include file='doc\OracleLob.uex' path='docs/doc[@for="OracleLob.Append"]/*' />
        public void Append(OracleLob source)
        {
            if (null == source)
            {
                throw ADP.ArgumentNull("source");
            }

            AssertObjectNotDisposed();
            source.AssertObjectNotDisposed();

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

            if (!source.IsNull)
            {
                AssertConnectionIsOpen();

                EnsureBuffering(false);

                int rc = TracedNativeMethods.OCILobAppend(
                    ServiceContextHandle,
                    ErrorHandle,
                    Descriptor,
                    source.Descriptor
                    );
                if (0 != rc)
                {
                    Connection.CheckError(ErrorHandle, rc);
                }
            }
        }
 public void Append(OracleLob source)
 {
     if (source == null)
     {
         throw System.Data.Common.ADP.ArgumentNull("source");
     }
     this.AssertObjectNotDisposed();
     source.AssertObjectNotDisposed();
     if (this.IsNull)
     {
         throw System.Data.Common.ADP.LobWriteInvalidOnNull();
     }
     if (!source.IsNull)
     {
         this.AssertConnectionIsOpen();
         int rc = TracedNativeMethods.OCILobAppend(this.ServiceContextHandle, this.ErrorHandle, this.Descriptor, source.Descriptor);
         if (rc != 0)
         {
             this.Connection.CheckError(this.ErrorHandle, rc);
         }
     }
 }
 public void Append(OracleLob source)
 {
     if (source == null)
     {
         throw System.Data.Common.ADP.ArgumentNull("source");
     }
     this.AssertObjectNotDisposed();
     source.AssertObjectNotDisposed();
     if (this.IsNull)
     {
         throw System.Data.Common.ADP.LobWriteInvalidOnNull();
     }
     if (!source.IsNull)
     {
         this.AssertConnectionIsOpen();
         int rc = TracedNativeMethods.OCILobAppend(this.ServiceContextHandle, this.ErrorHandle, this.Descriptor, source.Descriptor);
         if (rc != 0)
         {
             this.Connection.CheckError(this.ErrorHandle, rc);
         }
     }
 }
        public long CopyTo(long sourceOffset, OracleLob destination, long destinationOffset, long amount)
        {
            if (destination == null)
            {
                throw System.Data.Common.ADP.ArgumentNull("destination");
            }
            this.AssertObjectNotDisposed();
            destination.AssertObjectNotDisposed();
            this.AssertAmountIsValid(amount, "amount");
            this.AssertAmountIsValid(sourceOffset, "sourceOffset");
            this.AssertAmountIsValid(destinationOffset, "destinationOffset");
            if (destination.IsNull)
            {
                throw System.Data.Common.ADP.LobWriteInvalidOnNull();
            }
            if (this.IsNull)
            {
                return(0L);
            }
            this.AssertConnectionIsOpen();
            this.AssertTransactionExists();
            long num  = this.AdjustOffsetToOracle(Math.Min(this.Length - sourceOffset, amount));
            long num5 = this.AdjustOffsetToOracle(destinationOffset) + 1L;
            long num4 = this.AdjustOffsetToOracle(sourceOffset) + 1L;

            if (0L >= num)
            {
                return(0L);
            }
            int rc = TracedNativeMethods.OCILobCopy(this.ServiceContextHandle, this.ErrorHandle, destination.Descriptor, this.Descriptor, (uint)num, (uint)num5, (uint)num4);

            if (rc != 0)
            {
                this.Connection.CheckError(this.ErrorHandle, rc);
            }
            return(this.AdjustOracleToOffset(num));
        }
 public long CopyTo(long sourceOffset, OracleLob destination, long destinationOffset, long amount)
 {
     if (destination == null)
     {
         throw System.Data.Common.ADP.ArgumentNull("destination");
     }
     this.AssertObjectNotDisposed();
     destination.AssertObjectNotDisposed();
     this.AssertAmountIsValid(amount, "amount");
     this.AssertAmountIsValid(sourceOffset, "sourceOffset");
     this.AssertAmountIsValid(destinationOffset, "destinationOffset");
     if (destination.IsNull)
     {
         throw System.Data.Common.ADP.LobWriteInvalidOnNull();
     }
     if (this.IsNull)
     {
         return 0L;
     }
     this.AssertConnectionIsOpen();
     this.AssertTransactionExists();
     long num = this.AdjustOffsetToOracle(Math.Min(this.Length - sourceOffset, amount));
     long num5 = this.AdjustOffsetToOracle(destinationOffset) + 1L;
     long num4 = this.AdjustOffsetToOracle(sourceOffset) + 1L;
     if (0L >= num)
     {
         return 0L;
     }
     int rc = TracedNativeMethods.OCILobCopy(this.ServiceContextHandle, this.ErrorHandle, destination.Descriptor, this.Descriptor, (uint) num, (uint) num5, (uint) num4);
     if (rc != 0)
     {
         this.Connection.CheckError(this.ErrorHandle, rc);
     }
     return this.AdjustOracleToOffset(num);
 }
Esempio n. 6
0
        /// <include file='doc\OracleLob.uex' path='docs/doc[@for="OracleLob.CopyTo3"]/*' />
        public long CopyTo(
            long sourceOffset,
            OracleLob destination,
            long destinationOffset,
            long amount
            )
        {
            // Copies a range of elements from the lob to a compatible lob, starting at the specified index of the target array.

            if (null == destination)
            {
                throw ADP.ArgumentNull("destination");
            }

            AssertObjectNotDisposed();
            destination.AssertObjectNotDisposed();

            AssertAmountIsValid(amount, "amount");
            AssertAmountIsValid(sourceOffset, "sourceOffset");
            AssertAmountIsValid(destinationOffset, "destinationOffset");

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

            if (IsNull)
            {
                return(0);
            }

            AssertConnectionIsOpen();
            AssertTransactionExists();

            int rc;

            EnsureBuffering(false);
            destination.EnsureBuffering(false);

            long dataCount = AdjustOffsetToOracle(Math.Min(Length - sourceOffset, amount));
            long dstOffset = AdjustOffsetToOracle(destinationOffset) + 1;               // Oracle is 1 based, we are zero based.
            long srcOffset = AdjustOffsetToOracle(sourceOffset) + 1;                    // Oracle is 1 based, we are zero based.

            if (0 >= dataCount)
            {
                return(0);
            }

            rc = TracedNativeMethods.OCILobCopy(
                ServiceContextHandle,
                ErrorHandle,
                destination.Descriptor,
                Descriptor,
                (UInt32)dataCount,
                (UInt32)dstOffset,
                (UInt32)srcOffset
                );

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

            // DEVNOTE: Oracle must not do partial copies, because their API doesn't tell you how many bytes were copied.
            long byteCount = AdjustOracleToOffset(dataCount);

            return(byteCount);
        }