MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:mmatthews Date:August 30 2005 6:00pm
Subject:Connector/J commit: r4159 - branches/branch_3_1/connector-j/src/com/mysql/jdbc
View as plain text  
Modified:
   branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
Log:
check for lower-case-table-names on Windows when generating catalog name for getCallStmtParameterTypes().

Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java	2005-08-30 00:05:44 UTC (rev 4158)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java	2005-08-30 18:00:41 UTC (rev 4159)
@@ -1124,6 +1124,7 @@
 		java.sql.Statement paramRetrievalStmt = null;
 		java.sql.ResultSet paramRetrievalRs = null;
 
+		
 		if (parameterNamePattern == null) {
 			if (this.conn.getNullNamePatternMatchesAll()) {
 				parameterNamePattern = "%";
@@ -1153,14 +1154,33 @@
 		String parameterDef = null;
 
 		PreparedStatement paramRetrievalPreparedStatement = null;
-
+		
 		try {
-			paramRetrievalStmt = this.conn.createStatement();
-
-			if (paramRetrievalStmt.getMaxRows() != 0) {
-				paramRetrievalStmt.setMaxRows(0);
+			paramRetrievalStmt = this.conn.getMetadataSafeStatement();
+			
+			if (this.conn.lowerCaseTableNames()) {
+				// Workaround for bug in server wrt. to 
+				// SHOW CREATE PROCEDURE not respecting
+				// lower-case table names
+				
+				String oldCatalog = this.conn.getCatalog();
+				ResultSet rs = null;
+				
+				try {
+					this.conn.setCatalog(catalog);
+					paramRetrievalStmt.executeQuery("SELECT DATABASE()");
+					rs.next();
+					
+					catalog = rs.getString(1);
+					
+				} finally {
+					
+					this.conn.setCatalog(oldCatalog);
+					
+					rs.close();
+				}
 			}
-
+			
 			int dotIndex = -1;
 
 			if (!" ".equals(quoteChar)) {

Thread
Connector/J commit: r4159 - branches/branch_3_1/connector-j/src/com/mysql/jdbcmmatthews30 Aug