Modified:
branches/branch_3_1/connector-j/CHANGES
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
branches/branch_3_1/connector-j/src/testsuite/regression/MetaDataRegressionTest.java
Log:
Fixed BUG#12975 - OpenOffice expects
DBMD.supportsIntegrityEnhancementFacility() to return "true"
if foreign keys are supported by the datasource, even though
this method also covers support for check constraints,
which MySQL _doesn't_ have. Setting the configuration property
"overrideSpportsIntegrityEnhancementFacility" to "true" causes
the driver to return "true" for this method.
Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES 2005-11-17 01:02:11 UTC (rev 4557)
+++ branches/branch_3_1/connector-j/CHANGES 2005-11-17 14:53:48 UTC (rev 4558)
@@ -49,6 +49,14 @@
- Fixed BUG#14909 - escape processor replaces quote character
in quoted string with string delimiter.
+ - Fixed BUG#12975 - OpenOffice expects
+ DBMD.supportsIntegrityEnhancementFacility() to return "true"
+ if foreign keys are supported by the datasource, even though
+ this method also covers support for check constraints,
+ which MySQL _doesn't_ have. Setting the configuration property
+ "overrideSpportsIntegrityEnhancementFacility" to "true" causes
+ the driver to return "true" for this method.
+
10-07-05 - Version 3.1.11
- Fixed BUG#11629 - Spurious "!" on console when character
Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2005-11-17 01:02:11 UTC (rev 4557)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2005-11-17 14:53:48 UTC (rev 4558)
@@ -1140,6 +1140,15 @@
"Should the driver do strict checking (all primary keys selected) of updatable result sets (true, false, defaults to 'true')?",
"3.0.4", MISC_CATEGORY, Integer.MIN_VALUE);
+ private BooleanConnectionProperty overrideSupportsIntegrityEnhancementFacility =
+ new BooleanConnectionProperty("overrideSupportsIntegrityEnhancementFacility",
+ false,
+ "Should the driver return \"true\" for DatabaseMetaData.supportsIntegrityEnhancementFacility() "
+ + "even if the database doesn't support it to workaround applications that require this method to return "
+ + "\"true\" to signal support of foreign keys, even though the SQL specification states that this facility "
+ + "contains much more than just foreign key support (one such application being OpenOffice)?",
+ "3.1.12", MISC_CATEGORY, Integer.MIN_VALUE);
+
private BooleanConnectionProperty tinyInt1isBit = new BooleanConnectionProperty(
"tinyInt1isBit",
true,
@@ -3439,4 +3448,12 @@
public void setUseGmtMillisForDatetimes(boolean flag) {
this.useGmtMillisForDatetimes.setValue(flag);
}
+
+ protected boolean getOverrideSupportsIntegrityEnhancementFacility() {
+ return this.overrideSupportsIntegrityEnhancementFacility.getValueAsBoolean();
+ }
+
+ protected void setOverrideSupportsIntegrityEnhancementFacility(boolean flag) {
+ this.overrideSupportsIntegrityEnhancementFacility.setValue(flag);
+ }
}
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-11-17 01:02:11 UTC (rev 4557)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2005-11-17 14:53:48 UTC (rev 4558)
@@ -6819,7 +6819,11 @@
* DOCUMENT ME!
*/
public boolean supportsIntegrityEnhancementFacility() throws SQLException {
- return false;
+ if (!this.conn.getOverrideSupportsIntegrityEnhancementFacility()) {
+ return false;
+ }
+
+ return true;
}
/**
Modified: branches/branch_3_1/connector-j/src/testsuite/regression/MetaDataRegressionTest.java
===================================================================
--- branches/branch_3_1/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2005-11-17 01:02:11 UTC (rev 4557)
+++ branches/branch_3_1/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2005-11-17 14:53:48 UTC (rev 4558)
@@ -1255,6 +1255,34 @@
}
/**
+ * Tests fix for BUG#12975 - OpenOffice expects DBMD.supportsIEF()
+ * to return "true" if foreign keys are supported by the datasource,
+ * even though this method also covers support for check constraints,
+ * which MySQL _doesn't_ have.
+ *
+ * @throws Exception if the test fails.
+ */
+ public void testBug12975() throws Exception {
+ assertEquals(false, this.conn.getMetaData().supportsIntegrityEnhancementFacility());
+
+ Connection overrideConn = null;
+
+ try {
+ Properties props = new Properties();
+
+ props.setProperty("overrideSupportsIntegrityEnhancementFacility",
+ "true");
+
+ overrideConn = getConnectionWithProps(props);
+ assertEquals(true, overrideConn.getMetaData().supportsIntegrityEnhancementFacility());
+ } finally {
+ if (overrideConn != null) {
+ overrideConn.close();
+ }
+ }
+ }
+
+ /**
* Tests fix for BUG#13277 - RSMD for generated keys
* has NPEs when a connection is referenced.
*
@@ -1381,6 +1409,7 @@
}
}
}
+
private void checkRsmdForBug13277(ResultSetMetaData rsmd) throws SQLException {
assertEquals(17, rsmd.getColumnDisplaySize(1));
assertEquals(false, rsmd.isDefinitelyWritable(1));
| Thread |
|---|
| • Connector/J commit: r4558 - in branches/branch_3_1/connector-j: . src/com/mysql/jdbc src/testsuite/regression | mmatthews | 17 Nov |