[Mono-bugs] [Bug 60052][Nor] Changed - DataRow.SetValuesFromDataRecord bug

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 18 Jun 2004 04:55:14 -0400 (EDT)


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 carlosga@telefonica.net.

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

--- shadow/60052	2004-06-18 02:08:19.000000000 -0400
+++ shadow/60052.tmp.8388	2004-06-18 04:55:14.000000000 -0400
@@ -43,6 +43,104 @@
 ( If needed i can provider a test case )
 
 ------- Additional Comments From sumadevi@novell.com  2004-06-18 02:08 -------
 Can you please provide a testcase for the same.
 
 
+
+------- Additional Comments From carlosga@telefonica.net  2004-06-18 04:55 -------
+Sure.
+
+* I have run the test case in Fedora Core 1, using Firebird 1.5
+Classic Server and the Firebird .NET provider, the database sued is
+the employee.fdb taht ships with firebird.
+
+* The same test case works fine in .NET
+
+* The fill should return two rows.
+
+* The Fill error message is (this gives trying to convert a null 
+value to an int16):
+
+System.InvalidCastException: Cannot cast from source type to
+destination type.
+in <0x00024> System.DBNull:System.IConvertible.ToInt16
+(System.IFormatProvider)
+in <0x000bd> System.Convert:ToInt16 (object,System.IFormatProvider)
+in <0x00049> FirebirdSql.Data.Common.DbValue:GetInt16 ()
+in <0x00047> FirebirdSql.Data.Firebird.FbDataReader:GetInt16 (int)
+in <0x00026> Int16DataContainer:SetItemFromDataRecord
+(int,System.Data.IDataRecord,int)
+in <0x0015b> System.Data.DataRow:SetValuesFromDataRecord
+(System.Data.IDataRecord,int[])
+
+* The test case:
+
+using System;
+using System.Data;
+using System.Text;
+
+using FirebirdSql.Data.Firebird;
+
+namespace FirebirdSql.Data.Test
+{
+	class Class1
+	{
+		[STAThread]
+		static void Main(string[] args)
+		{
+			string connectionString =
+@"Database=/opt/firebird/examples/employee.fdb;user=sysdba;password=masterkey;Charset=NONE;Pooling=false;ServerType=0";
+
+			FbConnection connection = new FbConnection(connectionString);
+			connection.Open();
+
+			StringBuilder sql = new StringBuilder();
+
+			sql.Append(
+				@"SELECT " +
+				"pp.rdb$procedure_name AS PROCEDURE_NAME, " +
+				"pp.rdb$parameter_name AS PARAMETER_NAME, " +
+				"pp.rdb$parameter_type AS PARAMETER_TYPE, " +
+				"pp.rdb$parameter_number AS ORDINAL_POSITION, " +
+				"fld.rdb$field_type AS PARAMETER_DATA_TYPE, " +
+				"fld.rdb$field_sub_type AS PARAMETER_SUB_TYPE, " +
+				"fld.rdb$field_length AS COLUMN_SIZE, " +
+				"fld.rdb$field_precision AS NUMERIC_PRECISION, " +
+				"fld.rdb$field_scale AS NUMERIC_SCALE, " +
+				"cs.rdb$character_set_name AS CHARACTER_SET_NAME, " +
+				"coll.rdb$collation_name AS COLLATION_NAME, " +
+				"pp.rdb$description AS DESCRIPTION " +
+				"FROM " +
+				"rdb$procedure_parameters pp " +
+				"left join rdb$fields fld ON pp.rdb$field_source =
+fld.rdb$field_name " +
+				"left join rdb$character_sets cs ON cs.rdb$character_set_id =
+fld.rdb$character_set_id " +
+				"left join rdb$collations coll ON " + 
+				"(coll.rdb$collation_id = fld.rdb$collation_id AND
+coll.rdb$character_set_id = fld.rdb$character_set_id) ");
+
+			sql.Append(" WHERE pp.rdb$procedure_name = 'ADD_EMP_PROJ'");
+			sql.Append(" ORDER BY pp.rdb$procedure_name, pp.rdb$parameter_type,
+pp.rdb$parameter_number");
+
+			FbCommand command = new FbCommand(sql.ToString(), connection);
+			FbDataAdapter adapter = new FbDataAdapter(command);
+			FbCommandBuilder builder = new FbCommandBuilder(adapter);
+
+			adapter.FillError += new FillErrorEventHandler(FillError);
+
+			DataSet dsEmployee = new DataSet("employe");
+
+			adapter.Fill(dsEmployee, "employee");
+
+			connection.Close();
+		}
+
+		protected static void FillError(object sender, FillErrorEventArgs args)
+		{
+			Console.WriteLine("Fill error: {0}", args.Errors.ToString());
+		}
+	}
+}
+