List:Commits« Previous MessageNext Message »
From:rburnett Date:July 5 2007 7:31pm
Subject:Connector/NET commit: r777 - in branches/5.0: . Driver/Source TestSuite/Source
View as plain text  
Modified:
   branches/5.0/CHANGES
   branches/5.0/Driver/Source/ISSchemaProvider.cs
   branches/5.0/TestSuite/Source/StoredProcedure.cs
Log:
Bug #29526  	syntax error: "show create procedure" with catalog names containing hyphens

Fixed problem with calling stored procedures in databases that have hyphens
in their names.  We were not using backticks to quote the database and sproc name
when querying for metadata. (Bug #29526)


Modified: branches/5.0/CHANGES
===================================================================
--- branches/5.0/CHANGES	2007-07-05 15:43:07 UTC (rev 776)
+++ branches/5.0/CHANGES	2007-07-05 19:31:57 UTC (rev 777)
@@ -15,6 +15,9 @@
   - Changed behavior of ConnectionString property.  It now only returns the connection
     string given to it.  It will not attempt to track changes to the current
     database when the users uses the ChangeDatabase method. (Bug #29123)
+  - Fixed problem with calling stored procedures in databases that have hyphens
+    in their names.  We were not using backticks to quote the database and sproc name
+    when querying for metadata. (Bug #29526)
     
 Version 5.0.7 5/16/2007
 

Modified: branches/5.0/Driver/Source/ISSchemaProvider.cs
===================================================================
--- branches/5.0/Driver/Source/ISSchemaProvider.cs	2007-07-05 15:43:07 UTC (rev 776)
+++ branches/5.0/Driver/Source/ISSchemaProvider.cs	2007-07-05 19:31:57 UTC (rev 777)
@@ -353,7 +353,7 @@
 
             foreach (DataRow routine in routines.Rows)
             {
-                string showCreateSql = String.Format("SHOW CREATE {0} {1}.{2}",
+                string showCreateSql = String.Format("SHOW CREATE {0} `{1}`.`{2}`",
                     routine["ROUTINE_TYPE"], routine["ROUTINE_SCHEMA"],
                     routine["ROUTINE_NAME"]);
                 cmd.CommandText = showCreateSql;

Modified: branches/5.0/TestSuite/Source/StoredProcedure.cs
===================================================================
--- branches/5.0/TestSuite/Source/StoredProcedure.cs	2007-07-05 15:43:07 UTC (rev 776)
+++ branches/5.0/TestSuite/Source/StoredProcedure.cs	2007-07-05 19:31:57 UTC (rev 777)
@@ -1240,5 +1240,31 @@
             cmd.Parameters.Add(param);
             cmd.ExecuteNonQuery();
         }
+
+        /// <summary>
+        /// Bug #29526  	syntax error: "show create procedure" with catalog names containing hyphens
+        /// </summary>
+        [Test]
+        public void CatalogWithHyphens()
+        {
+            try
+            {
+                suExecSQL("CREATE DATABASE `foo-bar`");
+                string connStr = GetConnectionString(false) + ";database=foo-bar";
+                MySqlConnection c = new MySqlConnection(connStr);
+                c.Open();
+
+                MySqlCommand cmd = new MySqlCommand("CREATE PROCEDURE spTest() BEGIN SELECT 1; END", c);
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "spTest";
+                cmd.CommandType = CommandType.StoredProcedure;
+                Assert.AreEqual(1, cmd.ExecuteScalar());
+            }
+            finally
+            {
+                suExecSQL("DROP DATABASE IF EXISTS `foo-bar`");
+            }
+        }
 	}
 }

Thread
Connector/NET commit: r777 - in branches/5.0: . Driver/Source TestSuite/Sourcerburnett5 Jul