Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorVeerapuram Varadhan <v.varadhan@gmail.com>2010-03-26 15:23:21 +0300
committerVeerapuram Varadhan <v.varadhan@gmail.com>2010-03-26 15:23:21 +0300
commitf122b42443ac07080a6e85edbf8bfdbdc2d39c4d (patch)
tree7c9aea4a577fa95ab099e67597a65c9de5cd19b9 /mcs
parentde5e09e40e043cba32fe06a8ba5196611ed0c908 (diff)
2010-03-26 Veerapuram Varadhan <vvaradhan@novell.com>
** Patch by Daniel Morgan <monodanmorg@yahoo.com> * System.Data.OracleClient/OracleParameter.cs: clean up svn path=/branches/mono-2-6/mcs/; revision=154262
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog5
-rw-r--r--mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs106
2 files changed, 47 insertions, 64 deletions
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog
index 7548aa5c179..6e6a63ec532 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-26 Veerapuram Varadhan <vvaradhan@novell.com>
+
+ ** Patch by Daniel Morgan <monodanmorg@yahoo.com>
+ * System.Data.OracleClient/OracleParameter.cs: clean up
+
2010-03-24 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes #565149 - by Daniel Morgan <monodanmorg@yahoo.com>
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
index 2edef7d4d1c..9530ddaac01 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
@@ -76,7 +76,6 @@ namespace System.Data.OracleClient
IntPtr bindValue = IntPtr.Zero;
bool useRef;
OciDataType bindType;
- OracleType bindOracleType;
short indicator;
int bindSize;
@@ -476,10 +475,6 @@ namespace System.Data.OracleClient
svalue = svalue.Substring(0, size);
svalue = svalue.ToString () + '\0';
- }
-
- if (direction == ParameterDirection.Input ||
- direction == ParameterDirection.InputOutput) {
// convert managed type to memory allocated earlier
// in this case using OCIUnicodeToCharSet
@@ -499,10 +494,8 @@ namespace System.Data.OracleClient
// Fill buffer
status = OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, out rsize);
- }
-
- if (direction == ParameterDirection.ReturnValue || direction == ParameterDirection.Output) {
- // for Return and Output params, get size in bytes
+ } else {
+ // for Output and ReturnValue parameters, get size in bytes
bindSize = Encoding.UTF8.GetMaxByteCount (size + 1);
// allocate memory for oracle to place the results for the Return or Output param
bytes = new byte [bindSize];
@@ -628,8 +621,8 @@ namespace System.Data.OracleClient
bytes = new byte [bindSize];
OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, out rsize);
- }
- if (direction == ParameterDirection.ReturnValue || direction == ParameterDirection.Output) {
+ } else {
+ // Output and ReturnValue parameters allocate memory
bindSize = 30;
bytes = new byte [bindSize];
}
@@ -760,64 +753,50 @@ namespace System.Data.OracleClient
useRef = true;
}
break;
- default:
- // FIXME: move this up - see how Char, Number, and Date are done...
+ case OciDataType.Raw:
+ if (direction == ParameterDirection.Input) {
+ byte[] val = v as byte[];
+ bindValue = OciCalls.AllocateClear (val.Length);
+ Marshal.Copy (val, 0, bindValue, val.Length);
+ bindSize = val.Length;
+ } else
+ throw new NotImplementedException ("Raw parameters not implemented for InputOutput, Output, and Return");
+ break;
+ case OciDataType.LongRaw:
+ case OciDataType.LongVarRaw:
+ // TODO: See how LongVarChar and Raw are implemented
+ throw new NotImplementedException ("LongVarRaw not implemented.");
+ case OciDataType.RowIdDescriptor:
if (direction == ParameterDirection.Output ||
direction == ParameterDirection.InputOutput ||
direction == ParameterDirection.ReturnValue) {
- switch(ociType) {
- case OciDataType.RowIdDescriptor:
- size = 10;
- bindType = OciDataType.Char;
- bindSize = size * 2;
- bindOutValue = OciCalls.AllocateClear (bindSize);
- bindValue = bindOutValue;
- break;
- case OciDataType.RSet: // REF CURSOR
- cursor = IntPtr.Zero;
- OciCalls.OCIHandleAlloc (connection.Environment,
- out cursor,
- OciHandleType.Statement,
- 0,
- IntPtr.Zero);
-
+ size = 10;
+ bindType = OciDataType.Char;
+ bindSize = size * 2;
+ bindOutValue = OciCalls.AllocateClear (bindSize);
+ bindValue = bindOutValue;
+ } else
+ throw new NotImplementedException("data type RowIdDescriptor as Intput parameters");
+ break;
+ case OciDataType.RSet: // REF CURSOR
+ if (direction == ParameterDirection.Output ||
+ direction == ParameterDirection.InputOutput ||
+ direction == ParameterDirection.ReturnValue) {
+
+ cursor = IntPtr.Zero;
+ OciCalls.OCIHandleAlloc (connection.Environment,
+ out cursor,
+ OciHandleType.Statement,
+ 0,
+ IntPtr.Zero);
bindSize = 0;
- bindType = OciDataType.RSet;
- break;
- default:
- // define other types
- throw new NotImplementedException ("Data Type not implemented: " + ociType.ToString() + ".");
- } // switch of ociDataType for output
- bindValue = bindOutValue;
- }
- else if ((v == DBNull.Value || v == null || isnull == true) && direction == ParameterDirection.Input) {
- indicator = 0;
- bindType = OciDataType.VarChar2;
- bindSize = 0;
- }
- else {
- if (bindOracleType == OracleType.Raw) {
- byte[] val = v as byte[];
- bindValue = OciCalls.AllocateClear (val.Length);
- Marshal.Copy (val, 0, bindValue, val.Length);
- bindSize = val.Length;
- } else {
- svalue = v.ToString () + '\0';
- rsize = 0;
-
- // Get size of buffer
- OciCalls.OCIUnicodeToCharSet (statement.Parent, null, svalue, out rsize);
-
- // Fill buffer
- bytes = new byte[rsize];
- OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, out rsize);
-
- bindType = OciDataType.String;
- bindSize = bytes.Length;
- } // else oracleType
- } // else - Input, Ouput...
+ bindType = OciDataType.RSet;
+ } else
+ throw new NotImplementedException ("data type Ref Cursor not implemented for Input parameters");
break;
+ default:
+ throw new NotImplementedException ("Data Type not implemented: " + ociType.ToString() + ".");
}
}
@@ -1190,7 +1169,6 @@ namespace System.Data.OracleClient
if (!oracleTypeSet || !inferring )
oracleType = type;
- bindOracleType = type;
}
#if NET_2_0