Beispiel #1
0
        public int Read(byte[] buffer, uint offset, uint count, bool binary)
        {
            int  status = 0;
            uint amount = count;
            byte csfrm  = 0;

            // Character types are UTF-16, so amount of characters is 1/2
            // the amount of bytes
            if (!binary)
            {
                amount /= 2;
                status  = OciCalls.OCILobCharSetForm(environment,
                                                     ErrorHandle,
                                                     this,
                                                     out csfrm);
                if (status != 0)
                {
                    OciErrorInfo info = ErrorHandle.HandleError();
                    throw new OracleException(info.ErrorCode, info.ErrorMessage);
                }
            }

            status = OciCalls.OCILobRead(Service,
                                         ErrorHandle,
                                         this,
                                         ref amount,
                                         offset,
                                         buffer,
                                         count,
                                         IntPtr.Zero,
                                         IntPtr.Zero,
                                         1000, // OCI_UCS2ID
                                         csfrm);

            if (status != 0)
            {
                OciErrorInfo info = ErrorHandle.HandleError();
                throw new OracleException(info.ErrorCode, info.ErrorMessage);
            }

            return((int)amount);
        }