Ejemplo n.º 1
0
        internal void SetAttribute(
            OCI.ATTR attribute,
            string value,
            OciHandle errorHandle
            )
        {
            int valueLengthAsChars = value.Length;

            byte[] valueAsBytes       = new byte[valueLengthAsChars * 4];
            int    valueLengthAsBytes = GetBytes(value.ToCharArray(), 0, valueLengthAsChars, valueAsBytes, 0);

            int rc = TracedNativeMethods.OCIAttrSet(
                this,                       // trgthndlp/trghndltyp
                valueAsBytes,               // attributep
                valueLengthAsBytes,         // size
                attribute,                  // attrtype
                errorHandle                 // errhp
                );

            if (0 != rc)
            {
                OracleException.Check(errorHandle, rc);
            }

            GC.KeepAlive(this);
        }
Ejemplo n.º 2
0
 internal static void Trace(string fmtPrintfW, OciHandle a1, OCI.HTYPE a2, OCI.ATTR a3, OciHandle a4, string a5, uint a6, int a7)
 {
     if (((modFlags & ApiGroup.Trace) != ApiGroup.Off) && (modID != NoData))
     {
         NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, OciHandle.HandleValueToTrace(a1), a2.ToString(), OciHandle.GetAttributeName(a1, a3), OciHandle.HandleValueToTrace(a4), a5, a6, a7);
     }
 }
 internal static string GetAttributeName(OciHandle handle, OCI.ATTR atype)
 {
     if (OCI.HTYPE.OCI_DTYPE_PARAM == handle.HandleType)
     {
         return(((OCI.PATTR)atype).ToString());
     }
     return(atype.ToString());
 }
 static internal extern int OCIAttrSet
 (
     HandleRef trgthndlp,
     OCI.HTYPE trghndltyp,
     ref int attributep,
     int size,
     OCI.ATTR attrtype,
     HandleRef errhp
 );
        internal void SetAttribute(OCI.ATTR attribute, int value, OciErrorHandle errorHandle)
        {
            int rc = TracedNativeMethods.OCIAttrSet(this, ref value, 0, attribute, errorHandle);

            if (rc != 0)
            {
                OracleException.Check(errorHandle, rc);
            }
        }
 static internal extern int OCIAttrGet
 (
     HandleRef trgthndlp,
     OCI.HTYPE trghndltyp,
     out IntPtr attributep,                                      // can't return a handle ref!
     out int sizep,
     OCI.ATTR attrtype,
     HandleRef errhp
 );
 static internal extern int OCIAttrGet
 (
     HandleRef trgthndlp,
     OCI.HTYPE trghndltyp,
     out short attributep,
     out int sizep,
     OCI.ATTR attrtype,
     HandleRef errhp
 );
 static internal extern int OCIAttrSet
 (
     HandleRef trgthndlp,
     OCI.HTYPE trghndltyp,
     [In, MarshalAs(UnmanagedType.LPArray)]
     byte[]          attributep,
     int size,
     OCI.ATTR attrtype,
     HandleRef errhp
 );
        internal void GetAttribute(OCI.ATTR attribute, out int value, OciErrorHandle errorHandle)
        {
            uint sizep = 0;
            int  rc    = TracedNativeMethods.OCIAttrGet(this, out value, out sizep, attribute, errorHandle);

            if (rc != 0)
            {
                OracleException.Check(errorHandle, rc);
            }
        }
        internal void SetAttribute(OCI.ATTR attribute, string value, OciErrorHandle errorHandle)
        {
            uint length = (uint)value.Length;

            byte[] bytes = new byte[length * 4];
            uint   size  = this.GetBytes(value.ToCharArray(), 0, length, bytes, 0);
            int    rc    = TracedNativeMethods.OCIAttrSet(this, bytes, size, attribute, errorHandle);

            if (rc != 0)
            {
                OracleException.Check(errorHandle, rc);
            }
        }
        internal void GetAttribute(OCI.ATTR attribute, out string value, OciErrorHandle errorHandle, OracleConnection connection)
        {
            IntPtr zero  = IntPtr.Zero;
            uint   sizep = 0;
            int    rc    = TracedNativeMethods.OCIAttrGet(this, ref zero, ref sizep, attribute, errorHandle);

            if (rc != 0)
            {
                OracleException.Check(errorHandle, rc);
            }
            byte[] destination = new byte[sizep];
            Marshal.Copy(zero, destination, 0, (int)sizep);
            value = connection.GetString(destination);
        }
Ejemplo n.º 12
0
        internal void GetAttribute(
            OCI.ATTR attribute,
            out int value,
            OciHandle errorHandle
            )
        {
            int zero = 0;
            int rc   = TracedNativeMethods.OCIAttrGet(this, out value, out zero, attribute, errorHandle);

            if (0 != rc)
            {
                OracleException.Check(errorHandle, rc);
            }

            GC.KeepAlive(this);
        }
Ejemplo n.º 13
0
        internal void GetAttribute(
            OCI.ATTR attribute,
            out string value,
            OciHandle errorHandle,
            OracleConnection connection
            )
        {
            IntPtr tempptr;
            int    tempub4;
            int    rc = TracedNativeMethods.OCIAttrGet(this, out tempptr, out tempub4, attribute, errorHandle);

            if (0 != rc)
            {
                OracleException.Check(errorHandle, rc);
            }

            value = connection.GetString(tempptr, tempub4, false);

            GC.KeepAlive(this);
        }
Ejemplo n.º 14
0
        internal void SetAttribute(
            OCI.ATTR attribute,
            OciHandle value,
            OciHandle errorHandle
            )
        {
            int rc = TracedNativeMethods.OCIAttrSet(
                this,                   // trgthndlp/trghndltyp
                value,                  // attributep
                0,                      // size
                attribute,              // attrtype
                errorHandle             // errhp
                );

            if (0 != rc)
            {
                OracleException.Check(errorHandle, rc);
            }

            GC.KeepAlive(this);
        }
Ejemplo n.º 15
0
 internal static extern int OCIAttrGet(OciHandle trgthndlp, [In, MarshalAs(UnmanagedType.U4)] OCI.HTYPE trghndltyp, ref IntPtr attributep, ref uint sizep, [In, MarshalAs(UnmanagedType.U4)] OCI.ATTR attrtype, OciHandle errhp);
Ejemplo n.º 16
0
 internal static extern int OCIAttrSet(OciHandle trgthndlp, [In, MarshalAs(UnmanagedType.U4)] OCI.HTYPE trghndltyp, [In, MarshalAs(UnmanagedType.LPArray)] byte[] attributep, uint size, [In, MarshalAs(UnmanagedType.U4)] OCI.ATTR attrtype, OciHandle errhp);
Ejemplo n.º 17
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);
        }
Ejemplo n.º 18
0
        internal static int OCIAttrGet(OciHandle trgthndlp, OciHandle attributep, out uint sizep, OCI.ATTR attrtype, OciHandle errhp)
        {
            int num = System.Data.Common.UnsafeNativeMethods.OCIAttrGet(trgthndlp, trgthndlp.HandleType, attributep, out sizep, attrtype, errhp);

            if (Bid.AdvancedOn)
            {
                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, OciHandle.HandleValueToTrace(attributep), sizep, num);
            }
            return(num);
        }
Ejemplo n.º 19
0
 internal static int OCIAttrSet(OciHandle trgthndlp, OciHandle attributep, uint size, OCI.ATTR attrtype, OciHandle errhp)
 {
     if (Bid.AdvancedOn)
     {
         Bid.Trace("<oc.OCIAttrSet|ADV|OCI>              trgthndlp=0x%-07Ix trghndltyp=%-18ls attributep=0x%-07Ix size=%d attrtype=%-22ls errhp=0x%-07Ix\n", trgthndlp, trgthndlp.HandleType, attributep, size, attrtype, errhp);
     }
     return(System.Data.Common.UnsafeNativeMethods.OCIAttrSet(trgthndlp, trgthndlp.HandleType, attributep, size, attrtype, errhp));
 }
Ejemplo n.º 20
0
 internal static int OCIAttrSet(OciHandle trgthndlp, byte[] attributep, uint size, OCI.ATTR attrtype, OciHandle errhp)
 {
     if (Bid.AdvancedOn)
     {
         string str;
         if ((OCI.ATTR.OCI_ATTR_EXTERNAL_NAME == attrtype) || (OCI.ATTR.OCI_ATTR_INTERNAL_NAME == attrtype))
         {
             str = new string(Encoding.UTF8.GetChars(attributep, 0, (int)size));
         }
         else
         {
             str = attributep.ToString();
         }
         Bid.Trace("<oc.OCIAttrSet|ADV|OCI>              trgthndlp=0x%-07Ix trghndltyp=%-18ls attributep='%ls' size=%d attrtype=%-22ls errhp=0x%-07Ix\n", trgthndlp, trgthndlp.HandleType, str, size, attrtype, errhp);
     }
     return(System.Data.Common.UnsafeNativeMethods.OCIAttrSet(trgthndlp, trgthndlp.HandleType, attributep, size, attrtype, errhp));
 }