From: rburnett Date: August 21 2006 4:39pm Subject: Connector/NET commit: r323 - in trunk: . TestSuite mysqlclient List-Archive: http://lists.mysql.com/commits/10687 X-Bug: 21521 Message-Id: <200608211639.k7LGdX8b023525@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: trunk/CHANGES trunk/TestSuite/Syntax.cs trunk/mysqlclient/MySqlStream.cs trunk/mysqlclient/Statement.cs Log: Bug #21521 # Symbols not allowed in column/table names. Fixed by adding back ticks to the list of delimiters being looked for Also fixed a problem in MySqlStream where some error messages were not being handled right. Modified: trunk/CHANGES =================================================================== --- trunk/CHANGES 2006-08-18 21:27:49 UTC (rev 322) +++ trunk/CHANGES 2006-08-21 16:39:28 UTC (rev 323) @@ -1,5 +1,6 @@ Bugs fixed ---------- + Bug #21521 # Symbols not allowed in column/table names. Other changes ------------- Modified: trunk/TestSuite/Syntax.cs =================================================================== --- trunk/TestSuite/Syntax.cs 2006-08-18 21:27:49 UTC (rev 322) +++ trunk/TestSuite/Syntax.cs 2006-08-21 16:39:28 UTC (rev 323) @@ -326,5 +326,32 @@ Assert.AreEqual(1000, cnt); } + /// + /// Bug #21521 # Symbols not allowed in column/table names. + /// + [Test] + public void CommentSymbolInTableName() + { + try + { + execSQL("DROP TABLE IF EXISTS test"); + execSQL("CREATE TABLE test (`PO#` int(11) NOT NULL auto_increment, " + + "`PODate` date default NULL, PRIMARY KEY (`PO#`))"); + execSQL("INSERT INTO test ( `PO#`, `PODate` ) " + + "VALUES ( NULL, '2006-01-01' )"); + + string sql = "SELECT `PO#` AS PurchaseOrderNumber, " + + "`PODate` AS OrderDate FROM test"; + MySqlCommand cmd = new MySqlCommand(sql, conn); + MySqlDataAdapter da = new MySqlDataAdapter(cmd); + DataTable dt = new DataTable(); + da.Fill(dt); + Assert.AreEqual(1, dt.Rows.Count); + } + catch (Exception ex) + { + Assert.Fail(ex.Message); + } + } } } Modified: trunk/mysqlclient/MySqlStream.cs =================================================================== --- trunk/mysqlclient/MySqlStream.cs 2006-08-18 21:27:49 UTC (rev 322) +++ trunk/mysqlclient/MySqlStream.cs 2006-08-21 16:39:28 UTC (rev 323) @@ -273,7 +273,7 @@ // we read the byte this way because we might cross over a // multipacket boundary int cnt = Read(byteBuffer, 0, 1); - if (cnt == -1) + if (cnt <= 0) return -1; b = byteBuffer[0]; } Modified: trunk/mysqlclient/Statement.cs =================================================================== --- trunk/mysqlclient/Statement.cs 2006-08-18 21:27:49 UTC (rev 322) +++ trunk/mysqlclient/Statement.cs 2006-08-21 16:39:28 UTC (rev 323) @@ -192,7 +192,7 @@ sqlPart.Remove(0, sqlPart.Length); continue; } - else if ((c == '\'' || c == '\"') & !escaped & delim == Char.MinValue) + else if ((c == '\'' || c == '\"' || c == '`') & !escaped & delim == Char.MinValue) delim = c; else if (c == '\\') escaped = !escaped;