Пример #1
0
        void DefineLob(int position, OciDataType type, OracleConnection connection)
        {
            ociType = type;

            if (ociType == OciDataType.Clob)
            {
                fieldType = typeof(System.String);
            }
            else if (ociType == OciDataType.Blob)
            {
                fieldType = typeof(byte[]);
            }

            int status = 0;

            definedSize = -1;

            lobLocator = (OciLobLocator)connection.Environment.Allocate(OciHandleType.LobLocator);

            if (lobLocator == null)
            {
                OciErrorInfo info = connection.ErrorHandle.HandleError();
                throw new OracleException(info.ErrorCode, info.ErrorMessage);
            }

            value = lobLocator.Handle;
            lobLocator.ErrorHandle = connection.ErrorHandle;
            lobLocator.Service     = connection.ServiceContext;
            lobLocator.Environment = connection.Environment;

            status = OciCalls.OCIDefineByPosPtr(Parent,
                                                out handle,
                                                ErrorHandle,
                                                position + 1,
                                                ref value,
                                                definedSize,
                                                ociType,
                                                indicator,
                                                rlenp,
                                                IntPtr.Zero,
                                                0);

            definedSize = Int32.MaxValue;

            if (status != 0)
            {
                OciErrorInfo info = connection.ErrorHandle.HandleError();
                throw new OracleException(info.ErrorCode, info.ErrorMessage);
            }
        }
Пример #2
0
        void DefineInterval(int position, OciDataType type, OracleConnection connection)
        {
            ociType     = type;
            fieldType   = typeof(string);
            definedSize = -1;

            switch (type)
            {
            case OciDataType.IntervalDayToSecond:
                definedSize  = 11;
                intervalDesc = (OciIntervalDescriptor)connection.Environment.Allocate(OciHandleType.IntervalDayToSecond);
                break;

            case OciDataType.IntervalYearToMonth:
                intervalDesc = (OciIntervalDescriptor)connection.Environment.Allocate(OciHandleType.IntervalYearToMonth);
                definedSize  = 5;
                break;
            }

            if (intervalDesc == null)
            {
                OciErrorInfo info = connection.ErrorHandle.HandleError();
                throw new OracleException(info.ErrorCode, info.ErrorMessage);
            }

            value = intervalDesc.Handle;
            intervalDesc.ErrorHandle = ErrorHandle;

            int status = 0;

            status = OciCalls.OCIDefineByPosPtr(Parent,
                                                out handle,
                                                ErrorHandle,
                                                position + 1,
                                                ref value,
                                                definedSize,
                                                ociType,
                                                indicator,
                                                rlenp,
                                                IntPtr.Zero,
                                                0);

            if (status != 0)
            {
                OciErrorInfo info = connection.ErrorHandle.HandleError();
                throw new OracleException(info.ErrorCode, info.ErrorMessage);
            }
        }
Пример #3
0
        void DefineTimeStamp(int position, OracleConnection connection)
        {
            definedSize = -1;
            ociType     = OciDataType.TimeStamp;
            fieldType   = typeof(System.DateTime);

            dateTimeDesc = (OciDateTimeDescriptor)connection.Environment.Allocate(OciHandleType.TimeStamp);
            if (dateTimeDesc == null)
            {
                OciErrorInfo info = connection.ErrorHandle.HandleError();
                throw new OracleException(info.ErrorCode, info.ErrorMessage);
            }

            value = dateTimeDesc.Handle;
            dateTimeDesc.ErrorHandle = ErrorHandle;

            int status = 0;

            status = OciCalls.OCIDefineByPosPtr(Parent,
                                                out handle,
                                                ErrorHandle,
                                                position + 1,
                                                ref value,
                                                definedSize,
                                                ociType,
                                                indicator,
                                                rlenp,
                                                IntPtr.Zero,
                                                0);

            definedSize = 11;

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