Modified:
branches/branch_3_1/connector-j/CHANGES
branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
branches/branch_5_0/connector-j/CHANGES
branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
branches/branch_5_0/connector-j/src/testsuite/regression/MetaDataRegressionTest.java
trunk/connector-j/CHANGES
trunk/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
trunk/connector-j/src/testsuite/regression/MetaDataRegressionTest.java
Log:
Fixed BUG#18258 - DatabaseMetaData.getTables(), columns() with bad
catalog parameter threw exception rather than return empty result
set (as required by spec).
Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES 2006-10-10 14:45:22 UTC (rev 5851)
+++ branches/branch_3_1/connector-j/CHANGES 2006-10-10 14:59:46 UTC (rev 5852)
@@ -56,7 +56,11 @@
- Fixed bug where driver would not advance to next host if
roundRobinLoadBalance=true and the last host in the list is down.
-
+
+ - Fixed BUG#18258 - DatabaseMetaData.getTables(), columns() with bad
+ catalog parameter threw exception rather than return empty result
+ set (as required by spec).
+
05-26-06 - Version 3.1.13
- Fixed BUG#15464 - INOUT parameter does not store IN value.
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 2006-10-10
14:45:22 UTC (rev 5851)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2006-10-10
14:59:46 UTC (rev 5852)
@@ -4444,17 +4444,33 @@
try {
if (!conn.versionMeetsMinimum(5, 0, 2)) {
- results = stmt
+ try {
+ results = stmt
.executeQuery("SHOW TABLES FROM "
+ quotedId + catalogStr.toString()
+ quotedId + " LIKE '"
+ tableNamePat + "'");
+ } catch (SQLException sqlEx) {
+ if (SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE.equals(sqlEx.getSQLState())) {
+ throw sqlEx;
+ }
+
+ return;
+ }
} else {
- results = stmt
- .executeQuery("SHOW FULL TABLES FROM "
- + quotedId + catalogStr.toString()
- + quotedId + " LIKE '"
- + tableNamePat + "'");
+ try {
+ results = stmt
+ .executeQuery("SHOW FULL TABLES FROM "
+ + quotedId + catalogStr.toString()
+ + quotedId + " LIKE '"
+ + tableNamePat + "'");
+ } catch (SQLException sqlEx) {
+ if (SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE.equals(sqlEx.getSQLState())) {
+ throw sqlEx;
+ }
+
+ return;
+ }
}
boolean shouldReportTables = false;
Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES 2006-10-10 14:45:22 UTC (rev 5851)
+++ branches/branch_5_0/connector-j/CHANGES 2006-10-10 14:59:46 UTC (rev 5852)
@@ -275,7 +275,11 @@
- Fixed bug where driver would not advance to next host if
roundRobinLoadBalance=true and the last host in the list is down.
-
+
+ - Fixed BUG#18258 - DatabaseMetaData.getTables(), columns() with bad
+ catalog parameter threw exception rather than return empty result
+ set (as required by spec).
+
05-26-06 - Version 3.1.13
- Fixed BUG#15464 - INOUT parameter does not store IN value.
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2006-10-10
14:45:22 UTC (rev 5851)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2006-10-10
14:59:46 UTC (rev 5852)
@@ -4368,17 +4368,33 @@
try {
if (!conn.versionMeetsMinimum(5, 0, 2)) {
- results = stmt
+ try {
+ results = stmt
.executeQuery("SHOW TABLES FROM "
+ quotedId + catalogStr.toString()
+ quotedId + " LIKE '"
+ tableNamePat + "'");
+ } catch (SQLException sqlEx) {
+ if (SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE.equals(sqlEx.getSQLState())) {
+ throw sqlEx;
+ }
+
+ return;
+ }
} else {
- results = stmt
+ try {
+ results = stmt
.executeQuery("SHOW FULL TABLES FROM "
+ quotedId + catalogStr.toString()
+ quotedId + " LIKE '"
+ tableNamePat + "'");
+ } catch (SQLException sqlEx) {
+ if (SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE.equals(sqlEx.getSQLState())) {
+ throw sqlEx;
+ }
+
+ return;
+ }
}
boolean shouldReportTables = false;
Modified:
branches/branch_5_0/connector-j/src/testsuite/regression/MetaDataRegressionTest.java
===================================================================
---
branches/branch_5_0/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2006-10-10
14:45:22 UTC (rev 5851)
+++
branches/branch_5_0/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2006-10-10
14:59:46 UTC (rev 5852)
@@ -1676,4 +1676,17 @@
System.out.println(new String(this.rs.getBytes("TABLE_NAME"), "UTF-8"));
}
+ /**
+ * Tests fix for BUG#18258 - Nonexistent catalog/database causes SQLException
+ * to be raised, rather than returning empty result set.
+ *
+ * @throws Exception if the test fails.
+ */
+ public void testBug18258() throws Exception {
+ String bogusDatabaseName = "abcdefghijklmnopqrstuvwxyz";
+ this.conn.getMetaData().getTables(bogusDatabaseName, "%", "%", new String[] {"TABLE",
"VIEW"});
+ this.conn.getMetaData().getColumns(bogusDatabaseName, "%", "%", "%");
+ this.conn.getMetaData().getProcedures(bogusDatabaseName, "%", "%");
+ }
+
}
Modified: trunk/connector-j/CHANGES
===================================================================
--- trunk/connector-j/CHANGES 2006-10-10 14:45:22 UTC (rev 5851)
+++ trunk/connector-j/CHANGES 2006-10-10 14:59:46 UTC (rev 5852)
@@ -275,7 +275,11 @@
- Fixed bug where driver would not advance to next host if
roundRobinLoadBalance=true and the last host in the list is down.
-
+
+ - Fixed BUG#18258 - DatabaseMetaData.getTables(), columns() with bad
+ catalog parameter threw exception rather than return empty result
+ set (as required by spec).
+
05-26-06 - Version 3.1.13
- Fixed BUG#15464 - INOUT parameter does not store IN value.
Modified: trunk/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
===================================================================
--- trunk/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2006-10-10 14:45:22 UTC
(rev 5851)
+++ trunk/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2006-10-10 14:59:46 UTC
(rev 5852)
@@ -4371,17 +4371,33 @@
try {
if (!conn.versionMeetsMinimum(5, 0, 2)) {
- results = stmt
+ try {
+ results = stmt
.executeQuery("SHOW TABLES FROM "
+ quotedId + catalogStr.toString()
+ quotedId + " LIKE '"
+ tableNamePat + "'");
+ } catch (SQLException sqlEx) {
+ if (SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE.equals(sqlEx.getSQLState())) {
+ throw sqlEx;
+ }
+
+ return;
+ }
} else {
- results = stmt
+ try {
+ results = stmt
.executeQuery("SHOW FULL TABLES FROM "
+ quotedId + catalogStr.toString()
+ quotedId + " LIKE '"
+ tableNamePat + "'");
+ } catch (SQLException sqlEx) {
+ if (SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE.equals(sqlEx.getSQLState())) {
+ throw sqlEx;
+ }
+
+ return;
+ }
}
boolean shouldReportTables = false;
Modified: trunk/connector-j/src/testsuite/regression/MetaDataRegressionTest.java
===================================================================
--- trunk/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2006-10-10
14:45:22 UTC (rev 5851)
+++ trunk/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2006-10-10
14:59:46 UTC (rev 5852)
@@ -1665,4 +1665,17 @@
}
}
+ /**
+ * Tests fix for BUG#18258 - Nonexistent catalog/database causes SQLException
+ * to be raised, rather than returning empty result set.
+ *
+ * @throws Exception if the test fails.
+ */
+ public void testBug18258() throws Exception {
+ String bogusDatabaseName = "abcdefghijklmnopqrstuvwxyz";
+ this.conn.getMetaData().getTables(bogusDatabaseName, "%", "%", new String[] {"TABLE",
"VIEW"});
+ this.conn.getMetaData().getColumns(bogusDatabaseName, "%", "%", "%");
+ this.conn.getMetaData().getProcedures(bogusDatabaseName, "%", "%");
+ }
+
}
| Thread |
|---|
| • Connector/J commit: r5852 - branches/branch_3_1/connector-j branches/branch_3_1/connector-j/src/com/mysql/jdbc branches/branch_5_0/connector-j branche... | mmatthews | 10 Oct |