List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:August 25 2009 3:59pm
Subject:bzr commit into connector-net-5.2 branch (reggie.burnett:709)
View as plain text  
#At file:///D:/bzr-connector-net/new-5.2/ based on revid:reggie.burnett@stripped

  709 Reggie Burnett	2009-08-25
      removing last hack due to problems found

    modified:
      CHANGES
      MySql.Data/Provider/Source/CommandBuilder.cs
      MySql.Data/Provider/Source/command.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2009-08-21 18:49:35 +0000
+++ b/CHANGES	2009-08-25 15:59:00 +0000
@@ -1,4 +1,3 @@
-Test
 Version 5.2.8
 - fixed situation where TreatTinyAsBoolean had no effect with default database character set to UTF8
     (bug#46205)
@@ -14,6 +13,8 @@
 - fixed GetSByte method to actually return an sbyte  (bug #46620)
 - changed MySqlStream.Read to throw an exception if the stream end is reached.  This is not ideal
   but we can't change it too much here in 5.2.8.  We'll look at a bigger change in 6.2. (bug #45978)
+- adding a pretty nasty hack to enable output of a refresh select on the end of our insert
+  statements when they are generated by the TableAdapter config wizard (bug #37865)
 
 Version 5.2.7 7/13/09
 - fixed procedure parameters collection so that an exception is thrown if we can't get the 

=== modified file 'MySql.Data/Provider/Source/CommandBuilder.cs'
--- a/MySql.Data/Provider/Source/CommandBuilder.cs	2009-04-22 21:47:34 +0000
+++ b/MySql.Data/Provider/Source/CommandBuilder.cs	2009-08-25 15:59:00 +0000
@@ -241,7 +241,19 @@
 
         protected override DbCommand InitializeCommand(DbCommand command)
         {
-            return base.InitializeCommand(command);
+            MySqlCommand cmd = (MySqlCommand)base.InitializeCommand(command);
+            // if command is null then we assume we are auto-generated.  We
+            // are breaking with SqlClient and using FirstReturnedRecord as the
+            // default and then using a nasty hack to add a refresh select to the
+            // end of our insert statement
+            if (command == null)
+            {
+                cmd.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
+                if (finalSelect == null)
+                    CreateFinalSelect();
+                cmd.RefreshSelect = finalSelect;
+            }
+            return cmd; 
         }
 
 

=== modified file 'MySql.Data/Provider/Source/command.cs'
--- a/MySql.Data/Provider/Source/command.cs	2009-07-31 22:51:28 +0000
+++ b/MySql.Data/Provider/Source/command.cs	2009-08-25 15:59:00 +0000
@@ -59,6 +59,7 @@
         List<MySqlCommand> batch;
         private string batchableCommandText;
         internal string parameterHash;
+        internal string RefreshSelect;
 
 		/// <include file='docs/mysqlcommand.xml' path='docs/ctor1/*'/>
 		public MySqlCommand()
@@ -125,8 +126,13 @@
 					cmdText = cmdText.Substring(0, cmdText.Length - 14);
 					cmdText = cmdText + "() VALUES ()";
 				}
-
-			}
+                // this is a nasty hack to work around severe limitations with DbCommandBuilder
+                if (cmdText.StartsWith("INSERT INTO") && RefreshSelect != null)
+                {
+                    cmdText += RefreshSelect;
+                    RefreshSelect = null;
+                }
+            }
 		}
 
 		internal int UpdateCount


Attachment: [text/bzr-bundle] bzr/reggie.burnett@sun.com-20090825155900-j8j0j60zvpsoaun7.bundle
Thread
bzr commit into connector-net-5.2 branch (reggie.burnett:709)Reggie Burnett25 Aug