You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2006/08/03 22:13:31 UTC
svn commit: r428510 - in /db/derby/code/trunk/java:
client/org/apache/derby/client/am/ engine/org/apache/derby/impl/sql/catalog/
testing/org/apache/derbyTesting/functionTests/master/DerbyNet/
Author: rhillegas
Date: Thu Aug 3 13:13:30 2006
New Revision: 428510
URL: http://svn.apache.org/viewvc?rev=428510&view=rev
Log:
DERBY-1252: Commit derby1252.diff, causing various SUR-related metadata calls to report the correct answers based on the client and server rev levels.
Modified:
db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java?rev=428510&r1=428509&r2=428510&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java Thu Aug 3 13:13:30 2006
@@ -2314,7 +2314,91 @@
}
}
- private boolean getMetaDataInfoBooleanWithType(int infoCallIndex, int type) throws SQLException {
+
+ private boolean getMetaDataInfoBooleanWithType(int infoCallIndex, int type)
+ throws SQLException {
+
+ boolean clientValue =
+ getMetaDataInfoBooleanWithTypeClient(infoCallIndex, type);
+
+ // DERBY-1252. In Derby <= 10.x, clients (incl JCC) do not have
+ // logic to negotiate down these values with the server, so
+ // for features introduced with 10.x, x >= 2 (e.g. SUR
+ // DERBY-775, in 10.2), the server will return 10.0 values for
+ // any version 10.x so as not to break existing apps running
+ // an older 10 client (e.g. 10.1 client for DERBY-775).
+ // Reciprocally, this means clients at 10.x, where x => 2,
+ // must disregard the server's (too conservative) answers for
+ // these features, see logic in
+ // getMetaDataInfoBooleanWithTypeClient.
+ //
+ // For Derby >= 11, the down-negotiation code below which is
+ // presently commented out should be activated, and the values
+ // returned from the server should once more reflect reality.
+
+ // Commented out till we hit Derby 11:
+ //
+ // boolean serverValue =
+ // getMetaDataInfoBooleanWithTypeServer(infoCallIndex, type);
+ //
+ // return clientValue && serverValue;
+
+ return clientValue;
+ }
+
+
+ // Client's view of boolean metadata.
+ //
+ // For values which depend on (added) functionality in *both* the
+ // client and the server, the client should have its own view of
+ // all such values here. For other values, it can defer to the
+ // server. This is a prerequisite for negotiating down in a mixed
+ // client/Server context. Note that metadata negotiation should
+ // mirror the similar negotiation for use of the feature itself,
+ // for example, for scrollable updatable result sets of type
+ // insensitive, the server will downgrade to read-only if it is
+ // older than 10.2.
+ //
+ // See also comments in getMetaDataInfoBooleanWithType and
+ // engine/org/apache/derby/impl/sql/catalog/metadata_net.properties.
+ //
+ private boolean getMetaDataInfoBooleanWithTypeClient(int infoCallIndex,
+ int type)
+ throws SQLException {
+
+ switch (infoCallIndex) {
+ case updatesAreDetected__:
+ case deletesAreDetected__:
+ case ownUpdatesAreVisible__:
+ case ownDeletesAreVisible__:
+
+ if (productLevel_.greaterThanOrEqualTo(10,2,0) &&
+ type == ResultSet.TYPE_SCROLL_INSENSITIVE) {
+ return true;
+ } else {
+ return getMetaDataInfoBooleanWithTypeServer(infoCallIndex,
+ type);
+ }
+ case insertsAreDetected__:
+ case ownInsertsAreVisible__:
+ if (productLevel_.greaterThanOrEqualTo(10,2,0) &&
+ type == ResultSet.TYPE_SCROLL_INSENSITIVE) {
+ return false;
+ } else {
+ return getMetaDataInfoBooleanWithTypeServer(infoCallIndex,
+ type);
+ }
+ default:
+ return getMetaDataInfoBooleanWithTypeServer(infoCallIndex,
+ type);
+ }
+ }
+
+
+ private boolean getMetaDataInfoBooleanWithTypeServer(int infoCallIndex,
+ int type)
+ throws SQLException {
+
// Stored Procedure will return a String containing a
// comma seperated list of all the supported result Set types
// not throwing any exception right now even if the the type is wrong as per the spec
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties?rev=428510&r1=428509&r2=428510&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties Thu Aug 3 13:13:30 2006
@@ -234,6 +234,17 @@
# column 105 Encoding for DatabaseMetaData#deletesAreDetected
# column 106 Encoding for DatabaseMetaData#insertsAreDetected
#
+#
+# NOTE: DERBY-1252: Values for 98,99 and 104,105 do not reflect
+# truth, since DERBY-775 (SUR) is now implemented in 10.2.
+# When we move to major version 11, compatible clients shall handle
+# down negotiating so we can start returning truth again without risk
+# of breaking apps in mixed client/Server mode, i.e. old client/new
+# server. See also comments on this in
+# org.apache.derby.client.am.DatabaseMetaData
+# Value for 97 does reflect truth, though, since all < 10.2 clients
+# (and JCC) were broken parsing this anyway.
+
METADATA=\
SELECT \
M->allProceduresAreCallable(), \
@@ -333,14 +344,14 @@
M->dataDefinitionIgnoredInTransactions(), \
(cast (RTRIM(CAST(java.sql.ResultSet::TYPE_FORWARD_ONLY as CHAR(10))) AS VARCHAR(10)) || (',') || (cast (RTRIM(CAST(java.sql.ResultSet::TYPE_SCROLL_INSENSITIVE AS CHAR(10))) as VARCHAR(10)))), \
'1003,1007,1008;1004,1007,1008;1005', \
- '1004',\
- '1004',\
+ '',\
+ '',\
'',\
'1003',\
'1003',\
'1003',\
- '1004',\
- '1004',\
+ '',\
+ '',\
'',\
M->supportsBatchUpdates()\
from (values(getCurrentConnection()->getMetaData())) as DBMetaData(M)
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out?rev=428510&r1=428509&r2=428510&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/metadata.out Thu Aug 3 13:13:30 2006
@@ -184,8 +184,8 @@
ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
Scroll insensitive ResultSet see updates and deletes, but not inserts
-ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
-ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
Derby does not yet implement scroll sensitive resultsets and hence following metadata calls return false
ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
@@ -196,8 +196,8 @@
updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
-updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
-deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false
deletesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out?rev=428510&r1=428509&r2=428510&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/odbc_metadata.out Thu Aug 3 13:13:30 2006
@@ -214,8 +214,8 @@
ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY)? false
Scroll insensitive ResultSet see updates and deletes, but not inserts
-ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
-ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+ownDeletesAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
ownInsertsAreVisible(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
Derby does not yet implement scroll sensitive resultsets and hence following metadata calls return false
ownUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
@@ -226,8 +226,8 @@
updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY)? false
-updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
-deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? true
+updatesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
+deletesAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
insertsAreDetected(ResultSet.TYPE_SCROLL_INSENSITIVE)? false
updatesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false
deletesAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE)? false