2009-10-29 Veerapuram Varadhan <vvaradhan@novell.com>
authorVeerapuram Varadhan <v.varadhan@gmail.com>
Thu, 29 Oct 2009 02:02:12 +0000 (02:02 -0000)
committerVeerapuram Varadhan <v.varadhan@gmail.com>
Thu, 29 Oct 2009 02:02:12 +0000 (02:02 -0000)
        ** Fixes #321718
* OciCalls.cs: Add stub for OCILobCharSetForm to get the charset
        form associated with a CLOB/NCLOB.

        * OciLobLocator.cs: Add Environment handle property that is
        required to call OCILobCharSetForm and pass the output value to
OCILobRead.

        * OciDefineHandler.cs: Update Environment property of
        OCILobLocator.

svn path=/trunk/mcs/; revision=144980

mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/Changelog
mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciCalls.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDefineHandle.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciLobLocator.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs

index 0483725d35be666f93d35b8acc3fd706f49961cd..d187f5bdfafcb5a9d5cbfaa75330969d28728fe0 100644 (file)
@@ -1,4 +1,17 @@
-2009-10-27     Joerg Rosenkranz  <joergr@voelcker.com>
+2009-10-29  Veerapuram Varadhan  <vvaradhan@novell.com>
+
+       ** Fixes #321718
+       * OciCalls.cs: Add stub for OCILobCharSetForm to get the charset
+       form associated with a CLOB/NCLOB.
+
+       * OciLobLocator.cs: Add Environment handle property that is
+       required to call OCILobCharSetForm and pass the output value to
+       OCILobRead. 
+
+       * OciDefineHandler.cs: Update Environment property of
+       OCILobLocator.
+
+2009-10-27 Joerg Rosenkranz  <joergr@voelcker.com>
 
        * OciCalls.cs: Wrong function name in trace.
 
index 8f0638f8ab05c05b201d0bbd89936421dfba50d9..150ace5059823e18280e1b9fb0e51687eee200f9 100644 (file)
@@ -348,6 +348,12 @@ namespace System.Data.OracleClient.Oci
                                ushort csid,
                                byte csfrm);
 
+                       [DllImport ("oci")]
+                       internal static extern int OCILobCharSetForm (IntPtr svchp, 
+                               IntPtr errhp,
+                               IntPtr locp,
+                               out byte csfrm);
+                       
                        [DllImport ("oci")]
                        internal static extern int OCINlsGetInfo (IntPtr hndl,
                                IntPtr errhp,
@@ -969,6 +975,17 @@ namespace System.Data.OracleClient.Oci
                                piece, ctxp, cbfp, csid, csfrm);
                }
 
+               internal static int OCILobCharSetForm (IntPtr svchp, 
+                       IntPtr errhp,
+                       IntPtr locp,
+                       out byte csfrm)
+               {
+                       #if TRACE
+                       Trace.WriteLineIf(traceOci, "OCILobCharSetForm", "OCI");
+                       #endif
+                       return OciNativeCalls.OCILobCharSetForm (svchp, errhp, locp, out csfrm);                        
+               }
+               
                internal static int OCINlsGetInfo (IntPtr hndl,
                        IntPtr errhp,
                        ref byte[] bufp,
index d278d9c83a73d2c7bd5bc9f891f8469af3e89503..031646bd553359bd0493b68cf4bca3ed48139a6f 100644 (file)
@@ -338,6 +338,7 @@ namespace System.Data.OracleClient.Oci
                        value = lobLocator.Handle;
                        lobLocator.ErrorHandle = connection.ErrorHandle;
                        lobLocator.Service = connection.ServiceContext;
+                       lobLocator.Environment = connection.Environment;
 
                        status = OciCalls.OCIDefineByPosPtr (Parent,
                                                        out handle,
index e51c79e360f15497fbc939a9e7f9da802d8f9cdc..a5d12551fad49f73b4ed98880c6e7b468b784b06 100644 (file)
@@ -27,6 +27,7 @@ namespace System.Data.OracleClient.Oci {
                bool disposed = false;
                OciErrorHandle errorHandle;
                OciServiceHandle service;
+               OciEnvironmentHandle environment;
                OciDataType type;
 
                #endregion // Fields
@@ -57,6 +58,11 @@ namespace System.Data.OracleClient.Oci {
                        set { type = value; }
                }
                
+               public OciEnvironmentHandle Environment {
+                       get { return environment; }
+                       set { environment = value; }
+               }
+               
                #endregion // Properties
 
                #region Methods
@@ -164,12 +170,22 @@ namespace System.Data.OracleClient.Oci {
                {
                        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) 
+                       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,
@@ -180,7 +196,7 @@ namespace System.Data.OracleClient.Oci {
                                                IntPtr.Zero,
                                                IntPtr.Zero,
                                                1000,  // OCI_UCS2ID
-                                               0);    // Ignored if csid is specified as above
+                                               csfrm);
 
                        if (status != 0) {
                                OciErrorInfo info = ErrorHandle.HandleError ();
index 60cb9236e1455dd9b0be814fe22295be89c378ab..377f9ae06b82e232fc01f90215afb5ad239f4c34 100644 (file)
@@ -1,3 +1,8 @@
+2009-10-29  Veerapuram Varadhan  <vvaradhan@novell.com>
+
+       ** Fixes #321718
+       * OracleParameter.cs: Update Environment handle in OciLobLocator.
+       
 2009-09-30  Veerapuram Varadhan  <vvaradhan@novell.com>
 
        ** Fixes #543207
index 88eabec721b61426be8d1bf790f72a081b981f64..10a45797fbe9243690def5df81d4f7c626886503 100644 (file)
@@ -683,6 +683,7 @@ namespace System.Data.OracleClient
                                                bindValue = lobLocator.Handle;
                                                lobLocator.ErrorHandle = connection.ErrorHandle;
                                                lobLocator.Service = statement.Service;
+                                               lobLocator.Environment = connection.Environment;
                                                useRef = true;
                                        }
                                        break;
@@ -735,6 +736,7 @@ namespace System.Data.OracleClient
                                                bindValue = lobLocator.Handle;
                                                lobLocator.ErrorHandle = connection.ErrorHandle;
                                                lobLocator.Service = connection.ServiceContext;
+                                               lobLocator.Environment = connection.Environment;
                                                useRef = true;
                                        }
                                        break;