[Mono-bugs] [Bug 82147][Wis] New - just want to apologize for the last bug report i made, suspecting Mono's System.Data and Remoting incompatibility with Windows as the bugs. the real bug is on NpgsqlParameter

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Jul 20 06:59:36 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 miblogic at yahoo.com.

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

--- shadow/82147	2007-07-20 06:59:36.000000000 -0400
+++ shadow/82147.tmp.28998	2007-07-20 06:59:36.000000000 -0400
@@ -0,0 +1,240 @@
+Bug#: 82147
+Product: Mono: Runtime
+Version: 1.2
+OS: other
+OS Details: Ubuntu
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: remoting
+AssignedTo: lluis at ximian.com                            
+ReportedBy: miblogic at yahoo.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: just want to apologize for the last bug report i made, suspecting Mono's System.Data and Remoting incompatibility with Windows as the bugs.  the real bug is on NpgsqlParameter
+
+there is an error for dangling NpgsqlParamater
+
+my recommendation is to at least make npgsql library consistent on windows
+and on mono.  npgsqldataadapter on mono misbehaves when there is dangling
+npgsqlparameter.  don't know which which npgsql version is ideal when
+dealing with dangling npgsqlparamater, but i think the npgsql on .net
+behaves like silent error.  or at least make the two npgsql consistent with
+each other, so the developer would be more happy, i'm tracing the error for
+two days, i was about to analyze Npgsql source code, just doesn't have
+enough time to dabble with it :)
+
+
+kudos to Mono and Npgsql team for providing good tools to developers :)
+
+
+i can now say that Linux + Mono Remoting + Npgsql + PostgreSQL stack works! :)
+
+
+the code below (from my remoting middletier) works after i removed the
+p_mobile npgsqlparameter:
+
+
+public override void Company_Save(string companyCode, DataSet delta)
+{
+NpgsqlConnection c = Connect();
+
+NpgsqlTransaction tx = c.BeginTransaction();
+
+
+NpgsqlCommand updateCommand = new NpgsqlCommand(
+	@"update company set 
+		company = :p_company,
+		address_1 = :p_address_1,
+		address_2 = :p_address_2,
+
+		zip_code = :p_zip_code,
+		city = :p_city,
+		country = :p_country,
+		telephone = :p_telephone,
+		fax = :p_fax,
+		homepage = :p_homepage,
+		further_information = :p_further_information,
+
+		is_client = :p_is_client,
+		is_end_client = :p_is_end_client,
+		is_testing_institution = :p_is_testing_institution,
+		is_supplier = :p_is_supplier,
+		is_competitor = :p_is_competitor
+	
+	where 
+
+		company_code = :o_company_code
+
+		-- prevents stupidity :D modifying the primary key
+
+		and :p_company_code = :o_company_code
+			
+		
+		-- company type shouldn't change
+		
+		and :p_company_type_code = :o_company_type_code
+		", c);
+
+
+
+
+
+updateCommand.Parameters.Add("o_company_type_code", NpgsqlDbType.Varchar);
+updateCommand.Parameters["o_company_type_code"].SourceColumn =
+"company_type_code";
+updateCommand.Parameters["o_company_type_code"].SourceVersion =
+DataRowVersion.Original;
+
+
+updateCommand.Parameters.Add("p_company_type_code", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_company_type_code"].SourceColumn =
+"company_type_code";
+updateCommand.Parameters["p_company_type_code"].SourceVersion =
+DataRowVersion.Current;
+
+
+
+
+updateCommand.Parameters.Add("o_company_code", NpgsqlDbType.Varchar);
+updateCommand.Parameters["o_company_code"].SourceColumn = "company_code";
+updateCommand.Parameters["o_company_code"].SourceVersion =
+DataRowVersion.Original;
+
+updateCommand.Parameters.Add("p_company_code", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_company_code"].SourceColumn = "company_code";
+updateCommand.Parameters["p_company_code"].SourceVersion =
+DataRowVersion.Current;
+
+
+
+updateCommand.Parameters.Add("p_company", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_company"].SourceColumn = "company";
+
+
+
+
+
+
+updateCommand.Parameters.Add("p_address_1", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_address_1"].SourceColumn = "address_1";
+
+
+updateCommand.Parameters.Add("p_address_2", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_address_2"].SourceColumn = "address_2";
+
+
+updateCommand.Parameters.Add("p_zip_code", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_zip_code"].SourceColumn = "zip_code";
+
+
+updateCommand.Parameters.Add("p_city", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_city"].SourceColumn = "city";
+
+
+updateCommand.Parameters.Add("p_country", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_country"].SourceColumn = "country";
+
+updateCommand.Parameters.Add("p_telephone", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_telephone"].SourceColumn = "telephone";
+
+
+/*updateCommand.Parameters.Add("p_mobile", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_mobile"].SourceColumn = "mobile";*/
+
+
+
+
+
+updateCommand.Parameters.Add("p_fax", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_fax"].SourceColumn = "fax";
+updateCommand.Parameters["p_fax"].SourceVersion = DataRowVersion.Current;
+
+
+
+updateCommand.Parameters.Add("p_homepage", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_homepage"].SourceColumn = "homepage";
+
+
+updateCommand.Parameters.Add("p_further_information", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_further_information"].SourceColumn =
+"further_information";
+
+
+updateCommand.Parameters.Add("p_is_client", NpgsqlDbType.Boolean);
+updateCommand.Parameters["p_is_client"].SourceColumn = "is_client";
+
+updateCommand.Parameters.Add("p_is_end_client", NpgsqlDbType.Boolean);
+updateCommand.Parameters["p_is_end_client"].SourceColumn = "is_end_client";
+
+updateCommand.Parameters.Add("p_is_testing_institution", NpgsqlDbType.Boolean);
+updateCommand.Parameters["p_is_testing_institution"].SourceColumn =
+"is_testing_institution";
+
+updateCommand.Parameters.Add("p_is_supplier", NpgsqlDbType.Boolean);
+updateCommand.Parameters["p_is_supplier"].SourceColumn = "is_supplier";
+
+
+updateCommand.Parameters.Add("p_is_competitor", NpgsqlDbType.Varchar);
+updateCommand.Parameters["p_is_competitor"].SourceColumn = "is_competitor";
+
+
+NpgsqlDataAdapter da = new NpgsqlDataAdapter();
+
+da.InsertCommand = insertCommand;
+da.UpdateCommand = updateCommand;
+
+
+Console.WriteLine("Faxed: " +
+delta.Tables["company"].Rows[0]["fax"].ToString());
+
+da.Update(delta, "company");
+
+
+------------------
+
+prior to commenting the dangling npgsqlparameter(p_mobile), here's the
+result(on linux mono's npgsql), obtained from /var/log/postgresql: 
+
+
+update company set 
+        company = 'Xiamen C&D',
+        address_1 = 'aoeuaoeuX',
+        address_2 = '',
+
+        zip_code = '',
+        city = 'Xiamen',
+        country = 'China',
+        telephone = '592 2033 404 ext 7708',
+        fax = NULL,
+        homepage = NULL,
+        further_information = NULL,
+
+        is_client = NULL,
+        is_end_client = NULL,
+        is_testing_institution = NULL,
+        is_supplier = NULL,
+        is_competitor = NULL
+
+where 
+
+        company_code = '550'
+
+        -- prevents stupidity :D modifying the primary key
+
+        and '550' = '550'
+
+
+        -- company type shouldn't change
+
+        and 'C' = 'C'
+
+
+
+note: npgsql on windows just ignore the dangling npgsqlparameter, hence
+manifesting a "clean" program, or maybe it can be considered as silent
+error.  Francisco Figueiredo Jr should at least make the behavior identical
+on both platform


More information about the mono-bugs mailing list