List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:July 27 2010 7:42pm
Subject:bzr commit into connector-net-6.0 branch (reggie.burnett:827) Bug#55170
View as plain text  
#At file:///C:/work/connector-net/6.0/ based on revid:reggie.burnett@stripped

  827 Reggie Burnett	2010-07-27
      thought of a better way to fix bug #55170 right after the last push.  Here is the better version.

    modified:
      MySql.VisualStudio/DDEX/MySqlConnectionProperties.cs
      MySql.VisualStudio/Nodes/StoredProcedureNode.cs
=== modified file 'MySql.VisualStudio/DDEX/MySqlConnectionProperties.cs'
=== modified file 'MySql.VisualStudio/DDEX/MySqlConnectionProperties.cs'
--- a/MySql.VisualStudio/DDEX/MySqlConnectionProperties.cs	2010-07-27 19:31:53 +0000
+++ b/MySql.VisualStudio/DDEX/MySqlConnectionProperties.cs	2010-07-27 19:42:46 +0000
@@ -36,7 +36,6 @@
         /// </summary>
         public MySqlConnectionProperties() : base(InvariantName)
         {
-            ConnectionStringBuilder["Respect Binary Flags"] = false;
         }
 
         /// <summary>

=== modified file 'MySql.VisualStudio/Nodes/StoredProcedureNode.cs'
--- a/MySql.VisualStudio/Nodes/StoredProcedureNode.cs	2009-04-23 14:37:37 +0000
+++ b/MySql.VisualStudio/Nodes/StoredProcedureNode.cs	2010-07-27 19:42:46 +0000
@@ -121,21 +121,44 @@
             {
                 try
                 {
-                    DataTable dt = GetDataTable(String.Format("SHOW CREATE {0} `{1}`.`{2}`",
-                            IsFunction ? "FUNCTION" : "PROCEDURE", Database, Name));
-
-                    sql_mode = dt.Rows[0][1] as string;
-                    string sql = dt.Rows[0][2] as string;
+                    string sql = GetStoredProcedureBody(String.Format(
+                        "SHOW CREATE {0} `{1}`.`{2}`", 
+                        IsFunction ? "FUNCTION" : "PROCEDURE", Database, Name), out sql_mode);
                     editor.Text = ChangeSqlTypeTo(sql, "ALTER");
                     Dirty = false;
                 }
                 catch (Exception ex)
                 {
-                    MessageBox.Show("Unable to load object with error: " + ex.Message);
+                    MessageBox.Show("Unable to load the stored procedure for editing");
                 }
             }
 		}
 
+        private string GetStoredProcedureBody(string sql, out string sql_mode)
+        {
+            string body = null;
+
+            DbConnection conn = (DbConnection)HierarchyAccessor.Connection.GetLockedProviderObject();
+            try
+            {
+
+                DbCommand cmd = MySqlProviderObjectFactory.Factory.CreateCommand();
+                cmd.Connection = conn;
+                cmd.CommandText = sql;
+                using (DbDataReader reader = cmd.ExecuteReader())
+                {
+                    reader.Read();
+                    sql_mode = reader.GetString(1);
+                    body = reader.GetString(2);
+                }
+                return body;
+            }
+            finally
+            {
+                HierarchyAccessor.Connection.UnlockProviderObject();
+            }
+        }
+
         /// <summary>
         /// We override save here so we can change the sql from create to alter on
         /// first save


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20100727194246-v39ux5wif21bw1b2.bundle
Thread
bzr commit into connector-net-6.0 branch (reggie.burnett:827) Bug#55170Reggie Burnett27 Jul