Пример #1
0
        internal static int OCIServerVersion(OciHandle hndlp, OciHandle errhp, NativeBuffer bufp)
        {
            if (Bid.AdvancedOn)
            {
                Bid.Trace("<oc.OCIServerVersion|ADV|OCI>        hndlp=0x%-07Ix errhp=0x%-07Ix bufp=0x%-07Ix bufsz=%d hndltype=%d{OCI.HTYPE}\n", OciHandle.HandleValueToTrace(hndlp), OciHandle.HandleValueToTrace(errhp), NativeBuffer.HandleValueToTrace(bufp), bufp.Length, (int)hndlp.HandleType);
            }
            int num = System.Data.Common.UnsafeNativeMethods.OCIServerVersion(hndlp, errhp, bufp, (uint)bufp.Length, (byte)hndlp.HandleType);

            if (Bid.AdvancedOn)
            {
                Bid.Trace("<oc.OCIServerVersion|ADV|OCI|RET>    rc=%d\n%ls\n\n", num, hndlp.PtrToString(bufp));
            }
            return(num);
        }
Пример #2
0
        internal static int OCIAttrGet(OciHandle trgthndlp, ref IntPtr attributep, ref uint sizep, OCI.ATTR attrtype, OciHandle errhp)
        {
            int num = System.Data.Common.UnsafeNativeMethods.OCIAttrGet(trgthndlp, trgthndlp.HandleType, ref attributep, ref sizep, attrtype, errhp);

            if (Bid.AdvancedOn)
            {
                if (OCI.ATTR.OCI_ATTR_SQLCODE == attrtype)
                {
                    Bid.Trace("<oc.OCIAttrGet|ADV|OCI|RET>          trgthndlp=0x%-07Ix trghndltyp=%-18ls attrtype=%-22ls errhp=0x%-07Ix attributep=%-20ls sizep=%2d rc=%d\n", trgthndlp, trgthndlp.HandleType, attrtype, errhp, trgthndlp.PtrToString(attributep, (int)sizep), sizep, num);
                    return(num);
                }
                Bid.Trace("<oc.OCIAttrGet|ADV|OCI|RET>          trgthndlp=0x%-07Ix trghndltyp=%-18ls attrtype=%-22ls errhp=0x%-07Ix attributep=0x%-18Ix sizep=%2d rc=%d\n", trgthndlp, trgthndlp.HandleType, attrtype, errhp, attributep, sizep, num);
            }
            return(num);
        }
Пример #3
0
        internal static int OCIErrorGet(OciHandle hndlp, int recordno, out int errcodep, NativeBuffer bufp)
        {
            if (Bid.AdvancedOn)
            {
                Bid.Trace("<oc.OCIErrorGet|ADV|OCI>             hndlp=0x%-07Ix recordno=%d sqlstate=0x%-07Ix bufp=0x%-07Ix bufsiz=%d type=%d{OCI.HTYPE}\n", OciHandle.HandleValueToTrace(hndlp), recordno, IntPtr.Zero, NativeBuffer.HandleValueToTrace(bufp), bufp.Length, (int)hndlp.HandleType);
            }
            int num = System.Data.Common.UnsafeNativeMethods.OCIErrorGet(hndlp, (uint)recordno, IntPtr.Zero, out errcodep, bufp, (uint)bufp.Length, hndlp.HandleType);

            if (Bid.AdvancedOn)
            {
                Bid.Trace("<oc.OCIErrorGet|ADV|OCI|RET>         errcodep=%d rc=%d\n\t%ls\n\n", errcodep, num, hndlp.PtrToString(bufp));
            }
            return(num);
        }
Пример #4
0
        internal static int OCILobFileGetName(OciHandle envhp, OciHandle errhp, OciHandle filep, IntPtr dir_alias, ref ushort d_length, IntPtr filename, ref ushort f_length)
        {
            if (Bid.AdvancedOn)
            {
                Bid.Trace("<oc.OCILobFileGetName|ADV|OCI> envhp=0x%-07Ix errhp=0x%-07Ix filep=%Id\n", OciHandle.HandleValueToTrace(envhp), OciHandle.HandleValueToTrace(errhp), OciHandle.HandleValueToTrace(filep));
            }
            int num = System.Data.Common.UnsafeNativeMethods.OCILobFileGetName(envhp, errhp, filep, dir_alias, ref d_length, filename, ref f_length);

            if (Bid.AdvancedOn)
            {
                Bid.Trace("<oc.OCILobFileGetName|ADV|OCI|RET> rc=%d, dir_alias='%ls', d_lenght=%d, filename='%ls', f_length=%d\n", num, envhp.PtrToString(dir_alias, d_length), d_length, envhp.PtrToString(filename, f_length), f_length);
            }
            return(num);
        }
Пример #5
0
        internal OracleException(
            OciHandle errorHandle,
            int rc,
            NativeBuffer buf)
        {
            if (null == buf)
            {
                buf = new NativeBuffer_Exception(1000);
            }
            else if (buf.Length < 1000)
            {
                buf.Length = 1000;
            }


            if (null != errorHandle)
            {
                int record = 1;
                int rcTemp = TracedNativeMethods.OCIErrorGet(
                    errorHandle,
                    record,
                    ADP.NullHandleRef,
                    out code,
                    buf.Ptr,
                    buf.Length
                    );

                if (0 == rcTemp)
                {
                    message = errorHandle.PtrToString((IntPtr)buf.Ptr);

                    // For warning messages, revert back to the OCI7 routine to get
                    // the text of the message.
                    if (code != 0 && message.StartsWith("ORA-00000"))
                    {
                        message = TracedNativeMethods.oermsg(errorHandle, (short)code, buf);
                    }
                }
                else
                {
                    Debug.Assert(false, "Failed to get oracle message text");

                    // If we couldn't successfully read the message text, we pick
                    // something more descriptive, like "we couldn't read the message"
                    // instead of just handing back an empty string...
                    message = Res.GetString(Res.ADP_NoMessageAvailable, rc, rcTemp);
                    code    = 0;
                }
            }
#if USEORAMTS
            else
            {
                int length = buf.Length;
                code = 0;

                int rcTemp = TracedNativeMethods.OraMTSOCIErrGet(ref code, buf.Ptr, ref length);

                if (1 == rcTemp)
                {
                    message = Marshal.PtrToStringAnsi((IntPtr)buf.Ptr);
                }
                else
                {
                    Debug.Assert(false, "Failed to get oracle message text");

                    // If we couldn't successfully read the message text, we pick
                    // something more descriptive, like "we couldn't read the message"
                    // instead of just handing back an empty string...
                    message = Res.GetString(Res.ADP_NoMessageAvailable, rc, rcTemp);
                    code    = 0;
                }
            }
#endif //USEORAMTS
        }