trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [3/4] incubator-trafodion git commit: add set schema
Date Thu, 11 Aug 2016 16:58:32 GMT
add set schema


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/73c9e27d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/73c9e27d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/73c9e27d

Branch: refs/heads/master
Commit: 73c9e27dab4785b7c481e2a73ce83d6e1cbf1a5c
Parents: 4d73185
Author: mashengchen <mashengchen@gmail.com>
Authored: Mon Aug 1 04:51:40 2016 +0000
Committer: mashengchen <mashengchen@gmail.com>
Committed: Mon Aug 1 04:51:40 2016 +0000

----------------------------------------------------------------------
 .../org/trafodion/jdbc/t4/TrafT4Connection.java | 48 +++++++++++++++++++-
 1 file changed, 46 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/73c9e27d/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java
index a3a004f..8be2fd5 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Connection.java
@@ -1918,8 +1918,52 @@ public class TrafT4Connection extends PreparedStatementManager implements
java.s
 	}
 
 	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) {
+                            if (props_.getLogWriter() != null) {
+                                LogRecord lr = new LogRecord(Level.WARNING, "");
+                                Object p[] = T4LoggingUtilities.makeParams(props_, e.getMessage());
+                                lr.setParameters(p);
+                                lr.setSourceClassName("TrafT4Connection");
+                                lr.setSourceMethodName("setSchema");
+                                T4LogFormatter lf = new T4LogFormatter();
+                                String temp = lf.format(lr);
+                                props_.getLogWriter().println(temp);
+                            }
+                        }
+                    }
+                }
+            }
+
 	}
 
 	public void abort(Executor executor) throws SQLException {


Mime
View raw message