trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvaganesang <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #631: TRAFODION-1986 add code to setSchema ...
Date Fri, 05 Aug 2016 14:37:20 GMT
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/631#discussion_r73702591
  
    --- Diff: core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java ---
    @@ -1918,8 +1918,52 @@ public Struct createStruct(String typeName, Object[] attributes)
     	}
     
     	public void setSchema(String schema) throws SQLException {
    -		// TODO Auto-generated method stub
    -		
    +            if (props_.t4Logger_.isLoggable(Level.FINE) == true) {
    +                Object p[] = T4LoggingUtilities.makeParams(props_, schema);
    +                props_.t4Logger_.logp(Level.FINE, "TrafT4Connection", "setSchema", "",
p);
    +            }
    +            if (props_.getLogWriter() != null) {
    +                LogRecord lr = new LogRecord(Level.FINE, "");
    +                Object p[] = T4LoggingUtilities.makeParams(props_, schema);
    +                lr.setParameters(p);
    +                lr.setSourceClassName("TrafT4Connection");
    +                lr.setSourceMethodName("setSchema");
    +                T4LogFormatter lf = new T4LogFormatter();
    +                String temp = lf.format(lr);
    +                props_.getLogWriter().println(temp);
    +            }
    +            clearWarnings();
    +            if (_isClosed() == true) {
    +                throw TrafT4Messages.createSQLException(props_, null, "invalid_connection",
null);
    +            }
    +            if (schema != null && !"".equals(schema)) {
    +                Statement stmt = null;
    +                try {
    +                    stmt = createStatement();
    +                    stmt.execute("set schema " + schema);
    +                } catch (TrafT4Exception se) {
    +                    performConnectionErrorChecks(se);
    +                    throw se;
    +                } finally {
    +                    if (stmt != null) {
    +                        try {
    +                            stmt.close();
    +                        } catch (Exception e) {
    --- End diff --
    
    Consider changing the  Exception to SQLException or TrafT4Exception


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message