MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:mmatthews Date:August 30 2005 6:33pm
Subject:Connector/J commit: r4160 - in branches/branch_3_1/connector-j: . src/com/mysql/jdbc src/testsuite/regression
View as plain text  
Modified:
   branches/branch_3_1/connector-j/CHANGES
   branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
   branches/branch_3_1/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
Log:
Fixed BUG#12417 - Connection.prepareCall() is database name 
      case-sensitive (on Windows systems).

Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES	2005-08-30 18:00:41 UTC (rev 4159)
+++ branches/branch_3_1/connector-j/CHANGES	2005-08-30 18:33:36 UTC (rev 4160)
@@ -123,6 +123,9 @@
     - CallableStatement.clearParameters() now clears resources associated
       with INOUT/OUTPUT parameters as well as INPUT parameters.
       
+    - Fixed BUG#12417 - Connection.prepareCall() is database name 
+      case-sensitive (on Windows systems).
+      
 06-23-05 - Version 3.1.10-stable
 
 	- Fixed connecting without a database specified raised an exception

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 18:00:41 UTC (rev 4159)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java	2005-08-30 18:33:36 UTC (rev 4160)
@@ -1168,7 +1168,7 @@
 				
 				try {
 					this.conn.setCatalog(catalog);
-					paramRetrievalStmt.executeQuery("SELECT DATABASE()");
+					rs = paramRetrievalStmt.executeQuery("SELECT DATABASE()");
 					rs.next();
 					
 					catalog = rs.getString(1);
@@ -1236,10 +1236,14 @@
 								+ procNameBuf.toString());
 				parsingFunction = false;
 			} catch (SQLException sqlEx) {
-				paramRetrievalRs = paramRetrievalStmt
+				try {
+					paramRetrievalRs = paramRetrievalStmt
 						.executeQuery("SHOW CREATE FUNCTION "
 								+ procNameBuf.toString());
-				parsingFunction = true;
+					parsingFunction = true;
+				} catch (SQLException ex) {
+					throw sqlEx; // the original exception which made us try this in the first place...
+				}
 			}
 
 			if (paramRetrievalRs.next()) {

Modified: branches/branch_3_1/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java
===================================================================
--- branches/branch_3_1/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java	2005-08-30 18:00:41 UTC (rev 4159)
+++ branches/branch_3_1/connector-j/src/testsuite/regression/CallableStatementRegressionTest.java	2005-08-30 18:33:36 UTC (rev 4160)
@@ -519,4 +519,32 @@
 			}
 		}
 	}
+	
+	/**
+	 * Tests fix for Bug#12417 - stored procedure catalog name is
+	 * case-sensitive on Windows (this is actually a server bug,
+	 * but we have a workaround in place for it now).
+	 * 
+	 * @throws Exception if the test fails.
+	 */
+	public void testBug12417() throws Exception {
+		if (versionMeetsMinimum(5, 0) && isServerRunningOnWindows()) {
+			Connection ucCatalogConn = null;
+			
+			try {
+				this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS testBug12417");
+				this.stmt.executeUpdate("CREATE PROCEDURE testBug12417()\n"
+						+ "BEGIN\n" + "SELECT 1;" + "end\n");
+				ucCatalogConn = getConnectionWithProps(null);
+				ucCatalogConn.setCatalog(this.conn.getCatalog().toUpperCase());
+				ucCatalogConn.prepareCall("{call testBug12417()}");
+			} finally {
+				this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS testBug3539");
+				
+				if (ucCatalogConn != null) {
+					ucCatalogConn.close();
+				}
+			}
+		}
+	}
 }

Thread
Connector/J commit: r4160 - in branches/branch_3_1/connector-j: . src/com/mysql/jdbc src/testsuite/regressionmmatthews30 Aug