You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2018/08/22 22:23:17 UTC

[GitHub] gparai commented on a change in pull request #1425: DRILL-6647: Update Calcite version to 1.17.0

gparai commented on a change in pull request #1425: DRILL-6647: Update Calcite version to 1.17.0
URL: https://github.com/apache/drill/pull/1425#discussion_r212092928
 
 

 ##########
 File path: exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillConnectionImpl.java
 ##########
 @@ -419,279 +395,161 @@ public TimeZone getTimeZone() {
   // No isWrapperFor(Class<?>) (it doesn't throw SQLException if already closed).
   // No unwrap(Class<T>) (it doesn't throw SQLException if already closed).
 
-  @Override
-  public AvaticaStatement createStatement() throws SQLException {
-    throwIfClosed();
-    return super.createStatement();
-  }
-
-  @Override
-  public PreparedStatement prepareStatement(String sql) throws SQLException {
-    throwIfClosed();
-    return super.prepareStatement(sql);
-  }
-
   @Override
   public CallableStatement prepareCall(String sql) throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.prepareCall(sql);
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public String nativeSQL(String sql) throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.nativeSQL(sql);
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
-
-  @Override
-  public boolean getAutoCommit() throws SQLException {
-    throwIfClosed();
-    return super.getAutoCommit();
-  }
-
   // No close() (it doesn't throw SQLException if already closed).
 
-  @Override
-  public DatabaseMetaData getMetaData() throws SQLException {
-    throwIfClosed();
-    return super.getMetaData();
-  }
-
-  @Override
-  public void setReadOnly(boolean readOnly) throws SQLException {
-    throwIfClosed();
-    super.setReadOnly(readOnly);
-  }
-
-  @Override
-  public boolean isReadOnly() throws SQLException {
-    throwIfClosed();
-    return super.isReadOnly();
-  }
-
-  @Override
-  public void setCatalog(String catalog) throws SQLException {
-    throwIfClosed();
-    super.setCatalog(catalog);
-  }
-
-  @Override
-  public String getCatalog() {
-    // Can't throw any SQLException because AvaticaConnection's getCatalog() is
-    // missing "throws SQLException".
-    try {
-      throwIfClosed();
-    } catch (AlreadyClosedSqlException e) {
-      throw new RuntimeException(e.getMessage(), e);
-    }
-    return super.getCatalog();
-  }
-
-  @Override
-  public int getTransactionIsolation() throws SQLException {
-    throwIfClosed();
-    return super.getTransactionIsolation();
-  }
-
-  @Override
-  public SQLWarning getWarnings() throws SQLException {
-    throwIfClosed();
-    return super.getWarnings();
-  }
-
-  @Override
-  public void clearWarnings() throws SQLException {
-    throwIfClosed();
-    super.clearWarnings();
-  }
-
-  @Override
-  public Statement createStatement(int resultSetType,
-                                   int resultSetConcurrency) throws SQLException {
-    throwIfClosed();
-    return super.createStatement(resultSetType, resultSetConcurrency);
-  }
-
-  @Override
-  public PreparedStatement prepareStatement(String sql, int resultSetType,
-                                            int resultSetConcurrency) throws SQLException {
-    throwIfClosed();
-    return super.prepareStatement(sql, resultSetType, resultSetConcurrency);
-  }
-
   @Override
   public CallableStatement prepareCall(String sql, int resultSetType,
                                        int resultSetConcurrency) throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.prepareCall(sql, resultSetType, resultSetConcurrency);
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public Map<String,Class<?>> getTypeMap() throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.getTypeMap();
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public void setTypeMap(Map<String,Class<?>> map) throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       super.setTypeMap(map);
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
-  @Override
-  public void setHoldability(int holdability) throws SQLException {
-    throwIfClosed();
-    super.setHoldability(holdability);
-  }
-
-  @Override
-  public int getHoldability() throws SQLException {
-    throwIfClosed();
-    return super.getHoldability();
-  }
-
   @Override
   public CallableStatement prepareCall(String sql, int resultSetType,
                                        int resultSetConcurrency,
                                        int resultSetHoldability) throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.prepareCall(sql, resultSetType, resultSetConcurrency,
-                               resultSetHoldability);
-    }
-    catch (UnsupportedOperationException e) {
+        resultSetHoldability);
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public PreparedStatement prepareStatement(String sql,
                                             int autoGeneratedKeys) throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.prepareStatement(sql, autoGeneratedKeys);
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public PreparedStatement prepareStatement(String sql,
                                             int columnIndexes[]) throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.prepareStatement(sql, columnIndexes);
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public PreparedStatement prepareStatement(String sql,
                                             String columnNames[]) throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.prepareStatement(sql, columnNames);
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public Clob createClob() throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.createClob();
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public Blob createBlob() throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.createBlob();
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public NClob createNClob() throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.createNClob();
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public SQLXML createSQLXML() throws SQLException {
-    throwIfClosed();
+    checkOpen();
     try {
       return super.createSQLXML();
-    }
-    catch (UnsupportedOperationException e) {
+    } catch (UnsupportedOperationException e) {
       throw new SQLFeatureNotSupportedException(e.getMessage(), e);
     }
   }
 
   @Override
   public boolean isValid(int timeout) throws SQLException {
-    throwIfClosed();
-    try {
-      return super.isValid(timeout);
-    }
-    catch (UnsupportedOperationException e) {
 
 Review comment:
   Why don't we catch this exception any more?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services