[Mono-bugs] [Bug 81306][Nor] Changed - Wrong ODBC API definitions (using ints instead of shorts)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Apr 9 20:02:24 EDT 2007


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 will.mooar at tait.co.nz.

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

--- shadow/81306	2007-04-05 01:39:30.000000000 -0400
+++ shadow/81306.tmp.24806	2007-04-09 20:02:24.000000000 -0400
@@ -11,13 +11,13 @@
 AssignedTo: anagappan at novell.com                            
 ReportedBy: will.mooar at tait.co.nz               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
-Summary: UTF8Encoding.InternalGetCharCount fails during OdbcCommand.ExecuteReader with Informix
+Summary: Wrong ODBC API definitions (using ints instead of shorts)
 
 Description of Problem:
 An ArgumentOutOfRangeException is thrown within the
 UTF8Encoding.InternalGetCharCount function, during an
 OdbcCommand.ExecuteReader call using the Informix ODBC drivers and unixODBC
 layer.
@@ -247,6 +247,111 @@
                         return value;
                 }
 
 So in short, it doesn't appear to be a Mono bug at this time, but
 maybe the above patch might prove useful to anyone suffering this
 problem until the maintainers of unixODBC (or Informix ODBC) can fix this.
+
+------- Additional Comments From will.mooar at tait.co.nz  2007-04-09 20:02 -------
+ARGH! That'll teach me for being too quick off the mark.  Further
+investigation has found that the API definitions were wrong - using
+ints instead of shorts.
+
+NOTE: I have only fixed SQLColAttribute thus far.
+
+---------
+/usr/local/bin/diff -c1 System.Data.Odbc/OdbcDataReader.cs-old
+System.Data.Odbc/OdbcDataReader.cs
+
+*** System.Data.Odbc/OdbcDataReader.cs-old      Tue Apr 10 10:00:25 2007
+--- System.Data.Odbc/OdbcDataReader.cs  Tue Apr 10 09:59:43 2007
+***************
+*** 909,914 ****
+                          byte [] buffer = new byte [255];
+!                         int outsize = 0;
+                          int val = 0;
+!                         ret = libodbc.SQLColAttribute (hstmt,
+column, fieldId,
+!                                                        buffer,
+buffer.Length,
+                                                         ref outsize,
+ref val);
+--- 909,914 ----
+                          byte [] buffer = new byte [255];
+!                         short outsize = 0;
+                          int val = 0;
+!                         ret = libodbc.SQLColAttribute (hstmt,
+(short)column, fieldId,
+!                                                        buffer,
+(short)buffer.Length,
+                                                         ref outsize,
+ref val);
+***************
+*** 927,932 ****
+                          byte [] buffer = new byte [255];
+!                         int outsize = 0;
+                          int val = 0;
+!                         ret = libodbc.SQLColAttribute (hstmt,
+column, fieldId,
+!                                                        buffer,
+buffer.Length,
+                                                         ref outsize,
+ref val);
+--- 927,932 ----
+                          byte [] buffer = new byte [255];
+!                         short outsize = 0;
+                          int val = 0;
+!                         ret = libodbc.SQLColAttribute (hstmt,
+(short)column, fieldId,
+!                                                        buffer,
+(short)buffer.Length,
+                                                         ref outsize,
+ref val);
+
+/usr/local/bin/diff -c1 System.Data.Odbc/libodbc.cs-old
+System.Data.Odbc/libodbc.cs
+*** System.Data.Odbc/libodbc.cs-old     Tue Apr 10 10:10:21 2007
+--- System.Data.Odbc/libodbc.cs Tue Apr 10 09:45:57 2007
+***************
+*** 96,98 ****
+          // Keep this sorted.
+!         internal enum FieldIdentifier
+          {
+--- 96,98 ----
+          // Keep this sorted.
+!         internal enum FieldIdentifier : short
+          {
+***************
+*** 311,317 ****
+                  internal static extern OdbcReturn SQLColAttribute
+(IntPtr StmtHandle,
+!                                                                   
+int column,
+                                                                    
+FieldIdentifier fieldId,
+                                                                    
+byte [] charAttributePtr,
+!                                                                   
+int bufferLength,
+!                                                                   
+ref int strLengthPtr,
+                                                                    
+ref int numericAttributePtr
+--- 311,317 ----
+                  internal static extern OdbcReturn SQLColAttribute
+(IntPtr StmtHandle,
+!                                                                   
+short column,
+                                                                    
+FieldIdentifier fieldId,
+                                                                    
+byte [] charAttributePtr,
+!                                                                   
+short bufferLength,
+!                                                                   
+ref short strLengthPtr,
+                                                                    
+ref int numericAttributePtr
+
+
+
+Can someone please review/check-in my changes?


More information about the mono-bugs mailing list