From: Date: July 19 2007 12:09am Subject: Connector/NET commit: r790 - in trunk: Driver/Source TestSuite/Source List-Archive: http://lists.mysql.com/commits/31140 X-Bug: 29526 Message-Id: <200707182209.l6IM9QH7021170@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: trunk/Driver/Source/ISSchemaProvider.cs trunk/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. Modified: trunk/Driver/Source/ISSchemaProvider.cs =================================================================== --- trunk/Driver/Source/ISSchemaProvider.cs 2007-07-18 22:04:49 UTC (rev 789) +++ trunk/Driver/Source/ISSchemaProvider.cs 2007-07-18 22:09:26 UTC (rev 790) @@ -294,7 +294,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: trunk/TestSuite/Source/StoredProcedure.cs =================================================================== --- trunk/TestSuite/Source/StoredProcedure.cs 2007-07-18 22:04:49 UTC (rev 789) +++ trunk/TestSuite/Source/StoredProcedure.cs 2007-07-18 22:09:26 UTC (rev 790) @@ -1328,5 +1328,31 @@ cmd.Parameters.Add(param); cmd.ExecuteNonQuery(); } + + /// + /// Bug #29526 syntax error: "show create procedure" with catalog names containing hyphens + /// + [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`"); + } + } } }