Changeset: e9bfe3cf22e0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e9bfe3cf22e0
Modified Files:
        java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
        sql/jdbc/tests/Tests/Test_PSmetadata.stable.out
Branch: Jun2016
Log Message:

Removed unused private method getColumnResultSet(), private Map<Integer, 
ResultSet> colrs and private DatabaseMetaData dbmd.
Improved isCaseSensitive() to return true for charater data types. Code is now 
similar to ResultSetMetatData.isCaseSensitive().
Corrected getCatalogName() to return null always.


diffs (112 lines):

diff --git a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java 
b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
--- a/java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
+++ b/java/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
@@ -350,12 +350,6 @@ public class MonetPreparedStatement
 
                // return inner class which implements the ResultSetMetaData 
interface
                return new rsmdw() {
-                       // for the more expensive methods, we provide a simple 
cache
-                       // for the most expensive part; getting the ResultSet 
which
-                       // contains the data
-                       private DatabaseMetaData dbmd = null;
-                       private Map<Integer, ResultSet> colrs = new 
HashMap<Integer, ResultSet>();
-
                        /**
                         * Returns the number of columns in this ResultSet 
object.
                         *
@@ -402,7 +396,15 @@ public class MonetPreparedStatement
                         * @returns false
                         */
                        @Override
-                       public boolean isCaseSensitive(int column) {
+                       public boolean isCaseSensitive(int column) throws 
SQLException {
+                               switch (javaType[getColumnIdx(column)]) {
+                                       case Types.CHAR:
+                                       case Types.VARCHAR:
+                                       case Types.LONGVARCHAR: // MonetDB 
doesn't use type LONGVARCHAR, it's here for completeness
+                                       case Types.CLOB:
+                                               return true;
+                               }
+
                                return false;
                        }
 
@@ -554,8 +556,7 @@ public class MonetPreparedStatement
 
                        /**
                         * Gets the designated column's table's catalog name.
-                        * Because MonetDB handles only one catalog (dbfarm) at 
a
-                        * time, the current one is the one we deal with here.
+                        * MonetDB does not support the catalog naming concept 
as in: catalog.schema.table naming scheme
                         *
                         * @param column the first column is 1, the second is 
2, ...
                         * @return the name of the catalog for the table in 
which the given
@@ -563,7 +564,7 @@ public class MonetPreparedStatement
                         */
                        @Override
                        public String getCatalogName(int column) throws 
SQLException {
-                               return getConnection().getCatalog();
+                               return null;    // MonetDB does NOT support 
catalogs
                        }
 
                        /**
@@ -674,38 +675,6 @@ public class MonetPreparedStatement
                        public String getColumnTypeName(int column) throws 
SQLException {
                                return monetdbType[getColumnIdx(column)];
                        }
-
-                       /**
-                        * Returns the Metadata ResultSet for the given column
-                        * number of this ResultSet.  If the column was 
previously
-                        * requested, a cached ResultSet is returned, otherwise 
it
-                        * is fetched using the DatabaseMetaData class.
-                        *
-                        * @param column the column index number starting from 1
-                        * @return Metadata ResultSet
-                        * @throws SQLException if a database error occurs
-                        */
-                       @SuppressWarnings("unused")
-                       private ResultSet getColumnResultSet(int col)
-                               throws SQLException
-                       {
-                               if (!colrs.containsKey(col)) {
-                                       if (dbmd == null)
-                                               dbmd = 
getConnection().getMetaData();
-                                       ResultSet rscol = 
-                                               dbmd.getColumns(
-                                                               null, /* this 
doesn't matter here... */
-                                                               
schema[getColumnIdx(col)],
-                                                               
table[getColumnIdx(col)],
-                                                               
column[getColumnIdx(col)]
-                                                       );
-                                       colrs.put(col, rscol);
-                               }
-
-                               ResultSet res = (ResultSet)(colrs.get(col));
-                               res.beforeFirst();
-                               return res;
-                       }
                };
        }
 
diff --git a/sql/jdbc/tests/Tests/Test_PSmetadata.stable.out 
b/sql/jdbc/tests/Tests/Test_PSmetadata.stable.out
--- a/sql/jdbc/tests/Tests/Test_PSmetadata.stable.out
+++ b/sql/jdbc/tests/Tests/Test_PSmetadata.stable.out
@@ -144,7 +144,7 @@ 5.  null
        schemaname    
        tablename     table_test_psmetadata
        autoincrement false
-       casesensitive false
+       casesensitive true
        currency      false
        defwritable   false
        nullable      2
@@ -164,7 +164,7 @@ 6.  null
        schemaname    
        tablename     table_test_psmetadata
        autoincrement false
-       casesensitive false
+       casesensitive true
        currency      false
        defwritable   false
        nullable      2
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to