Example #1
0
        internal void EnsureBuffering(bool buffering)
        {
#if EXPOSELOBBUFFERING
            // Buffering not supported on BFiles yet.
            if (OracleType.BFile == _lobType)
            {
                return;
            }

            // DEVNOTE: see MDAC #77834 - We cannot call several OCI calls when buffering is
            //			enabled, but we can turn it off and on as needed...
            if (buffering != _isCurrentlyBuffered)
            {
                int rc;

                if (_isCurrentlyBuffered)
                {
                    Flush();

                    rc = TracedNativeMethods.OCILobDisableBuffering(ServiceContextHandle, ErrorHandle, Descriptor);

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

                    _isCurrentlyBuffered = false;
                }
                else if (OCI.CHARSETFORM.SQLCS_NCHAR != _charsetForm)
                {
                    // TODO: need to get Oracle to give us a fix for the crash in OCILobRead when reading with csfrm=SQLCS_NCHAR

                    rc = TracedNativeMethods.OCILobEnableBuffering(ServiceContextHandle, ErrorHandle, Descriptor);

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

                    _isCurrentlyBuffered = true;
                }
            }
#endif //EXPOSELOBBUFFERING
        }