[Mono-bugs] [Bug 81306][Nor] New - UTF8Encoding.InternalGetCharCount fails during OdbcCommand.ExecuteReader with Informix
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Apr 3 22:04:43 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-03 22:04:43.000000000 -0400
+++ shadow/81306.tmp.24208 2007-04-03 22:04:43.000000000 -0400
@@ -0,0 +1,197 @@
+Bug#: 81306
+Product: Mono: Class Libraries
+Version: 1.2
+OS: Solaris [Other]
+OS Details: Solaris SPARC 9
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.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
+
+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.
+
+Steps to reproduce the problem:
+1.
+2.
+3.
+
+Actual Results:
+SQL: SELECT ascii FROM ascii2chr WHERE chr='A'
+
+GLib: Cannot convert message: Conversion from character set 'UTF-8' to
+'646' is not supported
+
+Unhandled Exception: System.ArgumentOutOfRangeException: ArgRange_Array
+Parameter name: count
+ at System.Text.UTF8Encoding.InternalGetCharCount (System.Byte[] bytes,
+Int32 index, Int32 count, UInt32 leftOverBits, UInt32 leftOverCount,
+System.Object provider, System.Text.DecoderFallbackBuffer& fallbackBuffer,
+System.Byte[]& bufferArg, Boolean flush) [0x00000]
+ at System.Text.UTF8Encoding.GetCharCount (System.Byte[] bytes, Int32
+index, Int32 count) [0x00000]
+ at System.Text.Encoding.GetChars (System.Byte[] bytes, Int32 index, Int32
+count) [0x00000]
+ at System.Text.Encoding.GetString (System.Byte[] bytes, Int32 index,
+Int32 count) [0x00000]
+ at System.Text.UTF8Encoding.GetString (System.Byte[] bytes, Int32 index,
+Int32 count) [0x00000]
+ at System.Data.Odbc.OdbcDataReader.GetColumnAttributeStr (Int32 column,
+FieldIdentifier fieldId) [0x00000]
+ at System.Data.Odbc.OdbcDataReader.GetSchemaTable () [0x00000]
+ at System.Data.Odbc.OdbcDataReader..ctor (System.Data.Odbc.OdbcCommand
+command, CommandBehavior behavior) [0x00000]
+ at System.Data.Odbc.OdbcDataReader..ctor (System.Data.Odbc.OdbcCommand
+command, CommandBehavior behavior, Int32 recordAffected) [0x00000]
+ at (wrapper remoting-invoke-with-check)
+System.Data.Odbc.OdbcDataReader:.ctor
+(System.Data.Odbc.OdbcCommand,System.Data.CommandBehavior,int)
+ at System.Data.Odbc.OdbcCommand.ExecuteReader (CommandBehavior behavior)
+[0x00000]
+ at System.Data.Odbc.OdbcCommand.ExecuteDbDataReader (CommandBehavior
+behavior) [0x00000]
+ at System.Data.Common.DbCommand.ExecuteReader () [0x00000]
+ at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader ()
+[0x00000]
+ at Test.Main (System.String[] args) [0x00000]
+
+Expected Results:
+SQL: SELECT ascii FROM ascii2chr WHERE chr='A'
+Value: 65
+
+How often does this happen?
+Always
+
+Additional Information:
+
+Sample App:
+ using System;
+ using System.Data;
+ using System.Data.Odbc;
+
+ public class Test
+ {
+ public static void Main(string[] args)
+ {
+ string connectionString =
+ "Dsn=abc;" +
+ "Uid=xxx;" +
+ "Pwd=yyy";
+ OdbcConnection dbcon;
+ dbcon = new OdbcConnection(connectionString);
+ dbcon.Open();
+
+ string sql
+ = "SELECT ascii"
+ + " FROM ascii2chr"
+ + " WHERE chr='A'"
+ ;
+ Console.WriteLine("SQL: " + sql + "\n");
+
+ IDbCommand dbcmd = dbcon.CreateCommand();
+ dbcmd.CommandText = sql;
+
+//This line fails
+ IDataReader reader = dbcmd.ExecuteReader();
+
+ while(reader.Read()) {
+ object value = reader[0];
+ Console.WriteLine("Value: " +
+ value);
+ }
+ reader.Close();
+ reader = null;
+ dbcmd.Dispose();
+ dbcmd = null;
+ dbcon.Close();
+ dbcon = null;
+ }
+ }
+
+----------------------
+Schema for table:
+create table ascii2chr
+ (
+ ascii smallint,
+ chr char(1),
+ primary key (ascii)
+ );
+create unique index a2c_i1 on ascii2chr (chr);
+
+----------------------
+Data:
+256 records, containing values 0-255 in the ascii column, and chr$(0-255)
+in the chr column.
+
+----------------------
+odbc.ini: (and odbcinst.ini which is a link to odbc.ini)
+$ cat /usr/local/etc/odbc.ini
+[ODBC]
+;See
+http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.odbc.doc/odbcmst67.htm
+UNICODE=UCS-4
+;UNICODE=UTF-8
+Trace=0
+TraceFile=/tmp/odbctrace.out
+TraceDll=/apps/informix.odbc/lib/cli/odbctrac.so
+;InstallDir=/usr/local
+
+[ODBC Data Sources]
+b5dev=IBM Informix ODBC Driver
+
+[b5dev]
+Driver=IBM Informix ODBC Driver
+Description=IBM Informix ODBC Driver
+Database=baan5
+ServerName=b5dev
+;
+CLIENT_LOCALE=en_us.8859-1
+DB_LOCALE=en_us.8859-1
+TRANSLATIONDLL=/apps/informix.odbc/lib/esql/igo4a304.so
+;
+;LogonID=x
+;pwd=x
+;
+CURSORBEHAVIOR=0
+;DefaultUDTFetchType=SQL_C_BINARY
+;ENABLESCROLLABLECURSORS=1
+;ENABLEINSERTCURSORS=0
+;OPTIMIZEAUTOCOMMIT=1
+NEEDODBCTYPESONLY=1
+OPTOFC=1
+;REPORTKEYSETCURSORS=1
+FETCHBUFFERSIZE=32767
+DESCRIBEDECIMALFLOATPOINT=1
+USESERVERDBLOCALE=1
+;DONOTUSELVARCHAR=1
+;REPORTCHARCOLASWIDECHARCOL=0
+
+[ODBC Drivers]
+IBM Informix ODBC Driver=Installed
+;FileUsage=0
+
+[IBM Informix ODBC Driver]
+Driver=/apps/informix.odbc/lib/cli/iclis09b.so
+;Setup=/apps/informix.odbc/lib/cli/iclis09b.so
+ConnectFunctions=YYY
+DriverODBCVer=03.51
+;FileUsage=0
+APILevel=1
+SQLLevel=1
+smProcessPerConnect=Y
+
+Using:
+informix clientsdk.2.90.UC1.SOL
+unixodbc-2.1.1 or unixODBC-2.2.13pre
+mono-1.2.3.1_0.sunos8.novell.sparc.pkg
More information about the mono-bugs
mailing list