db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r382319 - 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/ testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ ...
Date Thu, 02 Mar 2006 08:25:29 GMT
Author: kahatlen
Date: Thu Mar  2 00:25:28 2006
New Revision: 382319

URL: http://svn.apache.org/viewcvs?rev=382319&view=rev
Log:
DERBY-965: DatabaseMetadata method supportsResultSetConcurrency
returns wrong result on network client

The DatabaseMetaData method supportsResultSetConcurrency erroneously
returns false on the network client for all arguments combination. The
embedded client returns correct results.

Patch contributed by Dag H. Wanvik <Dag.Wanvik@Sun.COM>.

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/DerbyNetClient/jdk14/metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata_test.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/DatabaseMetaData.java?rev=382319&r1=382318&r2=382319&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 Mar
 2 00:25:28 2006
@@ -2204,13 +2204,20 @@
     }
 
     private boolean getMetaDataInfoInt_SupportsResultSetConcurrency(int infoCallIndex, int
type, int concurrency) throws SQLException {
-        // The stored procured will return a String containg a list of concurrency and list
of resultSet types which support
-        // a perticular concurrency
-        // For eg. if the database supports concurrency CONCUR_READ_ONLY(1007) in ResultSet
type TYPE_FORWARD_ONLY(1003),
-        // TYPE_SCROLL_INSENSITIVE(1004), TYPE_SCROLL_SENSITIVE(1005) and
-        // supports concurrency CONCUR_UPDATBLE(1008) in resultSet TYPE_SCROLL_SENSITIVE(1005)
-        // then stored procedure will return a string "1007,1003,1004,1005;1008,1005"
-        // see how concurrency and supported result set types are seperated by ";"
+        // The stored procured will return a String containing a list
+        // of lists: For each result set type in the outer list, an
+        // inner list gives the allowed concurrencies for that type:
+	// The encoding syntax is reproduced here from the server file
+	// 'metadata_net.properties (please keep in synch!):  
+	//
+        // String syntax:  
+	// <type> { "," <concurrency>}* { ";" <type> { "," <concurrency>}*
}}*
+	//
+	// <type> ::= <the integer value for that type from interface java.sql.Resultset
+	//             i.e. TYPE_FORWARD_ONLY is 1003>
+	// <concurrency> ::= <the integer value for that concurrency
+	//                    from interface java.sql.Resultset, i.e.
+	//                    CONCUR_UPDATABLE is 1008>
         try
         {
             String returnedFromSP = null;
@@ -2222,10 +2229,11 @@
             }
             java.util.StringTokenizer st = new java.util.StringTokenizer(returnedFromSP,
";");
             while (st.hasMoreTokens()) {
-                java.util.StringTokenizer stForType = new java.util.StringTokenizer(st.nextToken(),
",");
-                if ((new Integer(stForType.nextToken())).intValue() == concurrency) {
-                    while (st.hasMoreTokens()) {
-                        if ((new Integer(st.nextToken())).intValue() == type) {
+                java.util.StringTokenizer stForConc = 
+		    new java.util.StringTokenizer(st.nextToken(), ",");
+                if ((new Integer(stForConc.nextToken())).intValue() == type) {
+                    while (stForConc.hasMoreTokens()) {
+                        if ((new Integer(stForConc.nextToken())).intValue() == concurrency)
{
                             return true;
                         }
                     }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/metadata_net.properties?rev=382319&r1=382318&r2=382319&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 Mar  2 00:25:28 2006
@@ -196,6 +196,44 @@
 
 #SYSIBM.Metadata gets several miscellanous database metadata values
 # for caching on the JCC side
+#
+# METADATA column comments
+#
+# column 97:
+# Encoding for DatabaseMetaData#supportsResultSetConcurrency.
+# If a concurrency is given for a type, supportsResultSetConcurrency 
+# will return true for that combination. Absence means false.
+# String syntax:  
+# <type> { "," <concurrency>}* { ";" <type> { "," <concurrency>}*
}}*
+#
+# <type> ::= <the integer value for that type from interface
+#             java.sql.Resultset i.e. TYPE_FORWARD_ONLY is 1003>
+# <concurrency> ::= <the integer value for that concurrency
+#                    from interface java.sql.Resultset, i.e.
+#                    CONCUR_UPDATABLE is 1008>	
+#
+# Please keep in synch with the client's decoding (in 
+# DatabaseMetaData.java)
+#
+# columns 98--106:
+#
+# For the following *AreVisible and *AreDetected methods.
+# The encoding is:  
+# If a type is given, the metadata method will give true for
+# that type, else false.
+#
+# column 98    Encoding for DatabaseMetaData#ownUpdatesAreVisible	 
+# column 99    Encoding for DatabaseMetaData#ownDeletesAreVisible	 
+# column 100   Encoding for DatabaseMetaData#ownInsertsAreVisible	 
+#
+# column 101   Encoding for DatabaseMetaData#othersUpdatesAreVisible 
+# column 102   Encoding for DatabaseMetaData#othersDeletesAreVisible 
+# column 103   Encoding for DatabaseMetaData#othersInsertsAreVisible	 
+#
+# column 104   Encoding for DatabaseMetaData#updatesAreDetected	 
+# column 105   Encoding for DatabaseMetaData#deletesAreDetected	 
+# column 106   Encoding for DatabaseMetaData#insertsAreDetected      
+#
 METADATA=\
 SELECT	\
 	M->allProceduresAreCallable(),	\
@@ -294,7 +332,7 @@
 	M->dataDefinitionCausesTransactionCommit(),	\
 	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,1008;1004,1008;1005,1007,1008', \
+	'1003,1007,1008;1004,1007;1005', \
 	'',\
 	'',\
 	'',\

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out?rev=382319&r1=382318&r2=382319&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/metadata.out
Thu Mar  2 00:25:28 2006
@@ -179,6 +179,12 @@
 othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_UPDATABLE: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE: false
 getConnection(): same connection
 getProcedureColumns():
 PROCEDURE_CAT[VARCHAR],PROCEDURE_SCHEM[VARCHAR],PROCEDURE_NAME[VARCHAR],COLUMN_NAME[VARCHAR],COLUMN_TYPE[SMALLINT],DATA_TYPE[SMALLINT],TYPE_NAME[VARCHAR],PRECISION[INTEGER],LENGTH[INTEGER],SCALE[SMALLINT],RADIX[SMALLINT],NULLABLE[SMALLINT],REMARKS[VARCHAR],METHOD_ID[SMALLINT],PARAMETER_ID[SMALLINT]

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out?rev=382319&r1=382318&r2=382319&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/metadata.out
Thu Mar  2 00:25:28 2006
@@ -179,6 +179,12 @@
 othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_UPDATABLE: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE: false
 getConnection(): same connection
 getProcedureColumns():
 PROCEDURE_CAT[VARCHAR],PROCEDURE_SCHEM[VARCHAR],PROCEDURE_NAME[VARCHAR],COLUMN_NAME[VARCHAR],COLUMN_TYPE[SMALLINT],DATA_TYPE[SMALLINT],TYPE_NAME[VARCHAR],PRECISION[INTEGER],LENGTH[INTEGER],SCALE[SMALLINT],RADIX[SMALLINT],NULLABLE[SMALLINT],REMARKS[VARCHAR],METHOD_ID[SMALLINT],PARAMETER_ID[SMALLINT]

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out?rev=382319&r1=382318&r2=382319&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/odbc_metadata.out
Thu Mar  2 00:25:28 2006
@@ -209,6 +209,12 @@
 othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_UPDATABLE: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE: false
 getConnection(): same connection
 getProcedureColumns():
 PROCEDURE_CAT[VARCHAR],PROCEDURE_SCHEM[VARCHAR],PROCEDURE_NAME[VARCHAR],COLUMN_NAME[VARCHAR],COLUMN_TYPE[SMALLINT],DATA_TYPE[SMALLINT],TYPE_NAME[VARCHAR],COLUMN_SIZE[INTEGER],BUFFER_LENGTH[INTEGER],DECIMAL_DIGITS[SMALLINT],NUM_PREC_RADIX[SMALLINT],NULLABLE[SMALLINT],REMARKS[VARCHAR],COLUMN_DEF[VARCHAR],SQL_DATA_TYPE[SMALLINT],SQL_DATETIME_SUB[SMALLINT],CHAR_OCTET_LENGTH[INTEGER],ORDINAL_POSITION[INTEGER],IS_NULLABLE[VARCHAR],METHOD_ID[SMALLINT],PARAMETER_ID[SMALLINT]

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out?rev=382319&r1=382318&r2=382319&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/metadata.out
Thu Mar  2 00:25:28 2006
@@ -179,6 +179,12 @@
 othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_UPDATABLE: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE: false
 getConnection(): same connection
 getProcedureColumns():
 PROCEDURE_CAT[VARCHAR],PROCEDURE_SCHEM[VARCHAR],PROCEDURE_NAME[VARCHAR],COLUMN_NAME[VARCHAR],COLUMN_TYPE[SMALLINT],DATA_TYPE[SMALLINT],TYPE_NAME[VARCHAR],PRECISION[INTEGER],LENGTH[INTEGER],SCALE[SMALLINT],RADIX[SMALLINT],NULLABLE[SMALLINT],REMARKS[VARCHAR],METHOD_ID[SMALLINT],PARAMETER_ID[SMALLINT]

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out?rev=382319&r1=382318&r2=382319&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/odbc_metadata.out
Thu Mar  2 00:25:28 2006
@@ -209,6 +209,12 @@
 othersUpdatesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
 othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? false
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_FORWARD_ONLY,CONCUR_UPDATABLE: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_READ_ONLY: true
+SupportsResultSetConcurrency: TYPE_SCROLL_INSENSITIVE,CONCUR_UPDATABLE: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_READ_ONLY: false
+SupportsResultSetConcurrency: TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE: false
 getConnection(): same connection
 getProcedureColumns():
 PROCEDURE_CAT[VARCHAR],PROCEDURE_SCHEM[VARCHAR],PROCEDURE_NAME[VARCHAR],COLUMN_NAME[VARCHAR],COLUMN_TYPE[SMALLINT],DATA_TYPE[SMALLINT],TYPE_NAME[VARCHAR],COLUMN_SIZE[INTEGER],BUFFER_LENGTH[INTEGER],DECIMAL_DIGITS[SMALLINT],NUM_PREC_RADIX[SMALLINT],NULLABLE[SMALLINT],REMARKS[VARCHAR],COLUMN_DEF[VARCHAR],SQL_DATA_TYPE[SMALLINT],SQL_DATETIME_SUB[SMALLINT],CHAR_OCTET_LENGTH[INTEGER],ORDINAL_POSITION[INTEGER],IS_NULLABLE[VARCHAR],METHOD_ID[SMALLINT],PARAMETER_ID[SMALLINT]

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata_test.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata_test.java?rev=382319&r1=382318&r2=382319&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata_test.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/metadata_test.java
Thu Mar  2 00:25:28 2006
@@ -668,6 +668,32 @@
 			System.out.println("othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? " + met.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));
 			System.out.println("othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE)? " + met.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));
 
+			if (!TestUtil.isJCCFramework()) { // gives false on all.. bug
+				int[] types = {ResultSet.TYPE_FORWARD_ONLY, 
+							   ResultSet.TYPE_SCROLL_INSENSITIVE,
+							   ResultSet.TYPE_SCROLL_SENSITIVE};
+	 
+				int[] conc  = {ResultSet.CONCUR_READ_ONLY, 
+							   ResultSet.CONCUR_UPDATABLE};
+
+				String[] typesStr = {"TYPE_FORWARD_ONLY", 
+									 "TYPE_SCROLL_INSENSITIVE",
+									 "TYPE_SCROLL_SENSITIVE"};
+			
+				String[] concStr  = {"CONCUR_READ_ONLY", 
+									 "CONCUR_UPDATABLE"};
+	 
+				for (int i = 0; i < types.length ; i++) {
+					for (int j = 0; j < conc.length; j++) {
+						System.out.println
+							("SupportsResultSetConcurrency: " +
+							 typesStr[i] + "," + concStr[j] + ": " +
+							 met.supportsResultSetConcurrency(types[i], 
+															  conc[j]));
+					}
+				}
+			}
+
 			System.out.println("getConnection(): "+
 					   ((met.getConnection()==con)?"same connection":"different connection") );
 			System.out.println("getProcedureColumns():");



Mime
View raw message