[Mono-bugs] [Bug 72677][Maj] Changed - Oracle : Invalid Argument in OCI call

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 19 Feb 2005 01:27:00 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by danielmorgan@verizon.net.

http://bugzilla.ximian.com/show_bug.cgi?id=72677

--- shadow/72677	2005-02-18 04:28:21.000000000 -0500
+++ shadow/72677.tmp.28237	2005-02-19 01:27:00.000000000 -0500
@@ -75,6 +75,49 @@
 
 ------- Additional Comments From informatique.internet@fiducial.fr  2005-02-18 04:28 -------
 This test cause a OCI-Invalid call exception on my box...  
 It works only if I replace DBNull.Value by a 
 System.data.OracleClient.OracleString(string.Empty); 
  
+
+------- Additional Comments From danielmorgan@verizon.net  2005-02-19 01:27 -------
+Here is a fix that works for me in OracleParameter function Bind().
+Basically, set indicator and bindSize to 0 and set the bindType to
+VARCHAR2.  It works for VARCAHR2, NUMBER, and DATE.
+
+OciDataType bindType = ociType;
+IntPtr bindValue = IntPtr.Zero;
+int bindSize = size;
+
+if (value == DBNull.Value) {
+	indicator = 0;
+	bindType = OciDataType.VarChar2;
+	bindSize = 0;
+}
+else {
+
+I would commit this, but I'm working in the same area trying to get
+DateTime to work.
+
+if (value == DBNull.Value) {
+	indicator = 0;
+	bindType = OciDataType.VarChar2;
+	bindSize = 0;
+}
+else {
+	if (oracleType == OracleType.DateTime) {
+	// FIXME: this only works 
+        // if NLS_DATE_FORMAT is set to 'DD-MMM-YY'
+	// which is the default date format for Oracle
+	string sDate = ((DateTime) value).ToString ("dd-MMM-yy").ToUpper ();
+					
+	bindType = OciDataType.VarChar2; 
+	bindValue = Marshal.StringToHGlobalAnsi (sDate);
+	bindSize = sDate.Length;
+}
+else {
+	bindType = OciDataType.VarChar2; // FIXME
+	bindValue = Marshal.StringToHGlobalAnsi (value.ToString ());
+	bindSize = value.ToString ().Length;
+}
+
+