List:Commits« Previous MessageNext Message »
From:mmatthews Date:October 23 2007 5:51pm
Subject:Connector/J commit: r6645 - branches/branch_5_1/src/testsuite/regression
View as plain text  
Modified:
   branches/branch_5_1/src/testsuite/regression/MetaDataRegressionTest.java
Log:
Testcase for bug 20491.

Modified: branches/branch_5_1/src/testsuite/regression/MetaDataRegressionTest.java
===================================================================
--- branches/branch_5_1/src/testsuite/regression/MetaDataRegressionTest.java	2007-10-23 17:49:01 UTC (rev 6644)
+++ branches/branch_5_1/src/testsuite/regression/MetaDataRegressionTest.java	2007-10-23 17:51:10 UTC (rev 6645)
@@ -1961,6 +1961,10 @@
 	 * @throws Exception if the test fails.
 	 */
 	public void testBug27867() throws Exception {
+		if (!versionMeetsMinimum(4, 1)) {
+			return;
+		}
+		
 		try {
 			String gbkColumnName = "\u00e4\u00b8\u00ad\u00e6\u2013\u2021\u00e6\u00b5\u2039\u00e8\u00af\u2022";
 			createTable("ColumnNameEncoding", "(" + "`" + gbkColumnName
@@ -2067,4 +2071,50 @@
 					typeNameToPrecision.get(typeName));
 		}
 	}
+	
+	public void testBug20491() throws Exception {
+		try {
+			String[] fields = { "field1_ae_+			"field4_sz_+			
+			createTable("tst",
+					"(`" + fields[0] + "` int(10) unsigned NOT NULL default '0',"
+							+ "`" + fields[1] + "` varchar(45) default '',"
+							+ "`" + fields[2] + "` varchar(45) default '',"
+							+ "`" + fields[3] + "` varchar(45) default '',"
+							+ "PRIMARY KEY  (`" + fields[0] + "`))");
+
+			// demonstrate that these are all in the Cp1252 encoding
+			
+			for (int i = 0; i < fields.length; i++) {
+				assertEquals(fields[i], new String(fields[i].getBytes("Cp1252"), "Cp1252"));
+			}
+			
+			byte[] asBytes = fields[0].getBytes("utf-8");
+			
+			DatabaseMetaData md = this.conn.getMetaData();
+			
+			this.rs = md.getColumns(null, "%", "tst", "%");
+			
+			int j = 0;
+			
+			while (this.rs.next()) {
+				assertEquals("Wrong column name:" + this.rs.getString(4),
+						fields[j++], this.rs.getString(4));
+			}
+			
+			this.rs.close();
+			
+			this.rs = this.stmt.executeQuery("SELECT * FROM tst");
+			
+			ResultSetMetaData rsmd = this.rs.getMetaData();
+			
+			for (int i = 1; i <= rsmd.getColumnCount(); i++) {
+				assertEquals("Wrong column name:" + rsmd.getColumnName(i),
+						fields[i - 1], rsmd.getColumnName(i));
+			}
+		} finally {
+			closeMemberJDBCResources();
+		}
+	}
 }

Thread
Connector/J commit: r6645 - branches/branch_5_1/src/testsuite/regressionmmatthews23 Oct