[Mono-list] System.Data.OracleClient - RAW support

eda eda@monetplus.cz
Fri, 09 Apr 2004 16:08:19 +0200


This is a multi-part message in MIME format.
--------------000801000400080306010803
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I added support for basic RAW data type in System.Data.OracleClient library.
If is someone responsible for this library please add attached patch to
CVS tree.

Copy this patch to mcs directory and type:

patch p1 < Systen.Data.OracleClinet-raw_support.diff


Eduard


--------------000801000400080306010803
Content-Type: text/plain;
 name="Systen.Data.OracleClinet-raw_support.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Systen.Data.OracleClinet-raw_support.diff"

--- mcs/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDefineHandle.cs	Sat Apr  3 17:19:03 2004
+++ mcs-my/class/System.Data.OracleClient/System.Data.OracleClient.Oci/OciDefineHandle.cs	Thu Apr  8 11:38:14 2004
@@ -110,6 +110,9 @@
 				definedSize = -1;
 				DefineLob (position, definedType);
 				return;
+            case OciDataType.Raw:
+                DefineRaw( position);
+                return;
 			default:
 				DefineChar (position); // HANDLE ALL OTHERS AS CHAR FOR NOW
 				return;
@@ -205,6 +208,32 @@
 			}
 		}
 
+        void DefineRaw( int position)
+        {
+        	ociType = OciDataType.Raw;
+			
+			value = Marshal.AllocHGlobal (definedSize);
+
+			int status = 0;
+
+			status = OciCalls.OCIDefineByPos (Parent,
+						out handle,
+						ErrorHandle,
+						position + 1,
+						value,
+						definedSize * 2,
+						ociType,
+						ref indicator,
+						ref rlenp,
+						IntPtr.Zero,
+						0);
+
+			if (status != 0) {
+				OciErrorInfo info = ErrorHandle.HandleError ();
+				throw new OracleException (info.ErrorCode, info.ErrorMessage);
+			}
+        }
+
 		protected override void Dispose (bool disposing) 
 		{
 			if (!disposed) {
@@ -259,6 +288,12 @@
 				break;
 			case OciDataType.Date:
 				return UnpackDate ();
+            case OciDataType.Raw:
+                byte[] raw_buffer = new byte [Size];
+
+                Marshal.Copy (Value, raw_buffer, 0, Size);
+
+                return raw_buffer;
 			}
 
 			return DBNull.Value;


--------------000801000400080306010803--