This is an automated email from the ASF dual-hosted git repository. geniuspig pushed a commit to branch jdbc_fix in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 06e2662cc7b1047100c4ef27233c49893d1b3c47 Author: zhutianci <[email protected]> AuthorDate: Wed Jan 15 23:57:49 2020 +0800 make jdbc easy to locate problem. --- .../org/apache/iotdb/jdbc/IoTDBConnection.java | 75 +++++++++++----------- .../java/org/apache/iotdb/jdbc/IoTDBStatement.java | 46 +++++++------ 2 files changed, 59 insertions(+), 62 deletions(-) diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java index cde7431..4760b9c 100644 --- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java +++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java @@ -54,7 +54,6 @@ public class IoTDBConnection implements Connection { private static final Logger logger = LoggerFactory.getLogger(IoTDBConnection.class); private static final TSProtocolVersion protocolVersion = TSProtocolVersion.IOTDB_SERVICE_PROTOCOL_V1; - private static final String METHOD_NOT_SUPPORTED = "Method not supported"; private TSIService.Iface client = null; private long sessionId = -1; private IoTDBConnectionParams params; @@ -90,17 +89,17 @@ public class IoTDBConnection implements Connection { @Override public boolean isWrapperFor(Class<?> arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support isWrapperFor"); } @Override public <T> T unwrap(Class<T> arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support unwrap"); } @Override public void abort(Executor arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support abort"); } @Override @@ -128,32 +127,32 @@ public class IoTDBConnection implements Connection { @Override public void commit() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support commit"); } @Override public Array createArrayOf(String arg0, Object[] arg1) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support createArrayOf"); } @Override public Blob createBlob() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support createBlob"); } @Override public Clob createClob() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support createClob"); } @Override public NClob createNClob() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not suppport createNClob"); } @Override public SQLXML createSQLXML() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support createSQLXML"); } @Override @@ -181,12 +180,12 @@ public class IoTDBConnection implements Connection { @Override public Statement createStatement(int arg0, int arg1, int arg2) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support createStatement"); } @Override public Struct createStruct(String arg0, Object[] arg1) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support createStruct"); } @Override @@ -206,22 +205,22 @@ public class IoTDBConnection implements Connection { @Override public void setCatalog(String arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support setCatalog"); } @Override public Properties getClientInfo() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support getClientInfo"); } @Override public void setClientInfo(Properties arg0) throws SQLClientInfoException { - throw new SQLClientInfoException(METHOD_NOT_SUPPORTED, null); + throw new SQLClientInfoException("Not support setClientInfo", null); } @Override public String getClientInfo(String arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support getClientInfo"); } @Override @@ -232,7 +231,7 @@ public class IoTDBConnection implements Connection { @Override public void setHoldability(int arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support setHoldability"); } @Override @@ -250,12 +249,12 @@ public class IoTDBConnection implements Connection { @Override public String getSchema() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support getSchema"); } @Override public void setSchema(String arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support setSchema"); } @Override @@ -265,17 +264,17 @@ public class IoTDBConnection implements Connection { @Override public void setTransactionIsolation(int arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support setTransactionIsolation"); } @Override public Map<String, Class<?>> getTypeMap() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support getTypeMap"); } @Override public void setTypeMap(Map<String, Class<?>> arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support setTypeMap"); } @Override @@ -295,33 +294,33 @@ public class IoTDBConnection implements Connection { @Override public void setReadOnly(boolean arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support setReadOnly"); } @Override public boolean isValid(int arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + return !isClosed; } @Override public String nativeSQL(String arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support nativeSQL"); } @Override public CallableStatement prepareCall(String arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support prepareCall"); } @Override public CallableStatement prepareCall(String arg0, int arg1, int arg2) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support prepareCall"); } @Override public CallableStatement prepareCall(String arg0, int arg1, int arg2, int arg3) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support prepareCall"); } @Override @@ -331,34 +330,34 @@ public class IoTDBConnection implements Connection { @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support prepareStatement"); } @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support prepareStatement"); } @Override public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support prepareStatement"); } @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support prepareStatement"); } @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support prepareStatement"); } @Override public void releaseSavepoint(Savepoint arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support releaseSavepoint"); } @Override @@ -373,22 +372,22 @@ public class IoTDBConnection implements Connection { @Override public void setClientInfo(String arg0, String arg1) throws SQLClientInfoException { - throw new SQLClientInfoException(METHOD_NOT_SUPPORTED, null); + throw new SQLClientInfoException("Not support setClientInfo", null); } @Override public void setNetworkTimeout(Executor arg0, int arg1) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support setNetworkTimeout"); } @Override public Savepoint setSavepoint() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support setSavepoint"); } @Override public Savepoint setSavepoint(String arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED); + throw new SQLException("Not support setSavepoint"); } public TSIService.Iface getClient() { diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java index 542668c..cacc7fd 100644 --- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java +++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java @@ -32,8 +32,6 @@ import java.util.List; public class IoTDBStatement implements Statement { - private static final String METHOD_NOT_SUPPORTED_STRING = "Method not supported"; - ZoneId zoneId; private ResultSet resultSet = null; private IoTDBConnection connection; @@ -166,7 +164,7 @@ public class IoTDBStatement implements Statement { @Override public void closeOnCompletion() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support closeOnCompletion"); } @Override @@ -194,17 +192,17 @@ public class IoTDBStatement implements Statement { @Override public boolean execute(String arg0, int arg1) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support execute"); } @Override public boolean execute(String arg0, int[] arg1) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support execute"); } @Override public boolean execute(String arg0, String[] arg1) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support execute"); } /** @@ -368,17 +366,17 @@ public class IoTDBStatement implements Statement { @Override public int executeUpdate(String arg0, int arg1) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support executeUpdate"); } @Override public int executeUpdate(String arg0, int[] arg1) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support executeUpdate"); } @Override public int executeUpdate(String arg0, String[] arg1) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support executeUpdate"); } private int executeUpdateSQL(String sql) throws TException, IoTDBSQLException { @@ -431,38 +429,38 @@ public class IoTDBStatement implements Statement { @Override public ResultSet getGeneratedKeys() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support getGeneratedKeys"); } @Override public int getMaxFieldSize() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support getMaxFieldSize"); } @Override public void setMaxFieldSize(int arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support getMaxFieldSize"); } @Override public int getMaxRows() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support getMaxRows"); } @Override public void setMaxRows(int num) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING + + throw new SQLException("Not support getMaxRows" + ". Please use the LIMIT clause in a query instead."); } @Override public boolean getMoreResults() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support getMoreResults"); } @Override public boolean getMoreResults(int arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support getMoreResults"); } @Override @@ -487,12 +485,12 @@ public class IoTDBStatement implements Statement { @Override public int getResultSetConcurrency() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support getResultSetConcurrency"); } @Override public int getResultSetHoldability() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support getResultSetHoldability"); } @Override @@ -503,7 +501,7 @@ public class IoTDBStatement implements Statement { @Override public int getUpdateCount() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + return -1; } @Override @@ -513,7 +511,7 @@ public class IoTDBStatement implements Statement { @Override public boolean isCloseOnCompletion() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support isCloseOnCompletion"); } @Override @@ -523,22 +521,22 @@ public class IoTDBStatement implements Statement { @Override public boolean isPoolable() throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support isPoolable"); } @Override public void setPoolable(boolean arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support setPoolable"); } @Override public void setCursorName(String arg0) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support setCursorName"); } @Override public void setEscapeProcessing(boolean enable) throws SQLException { - throw new SQLException(METHOD_NOT_SUPPORTED_STRING); + throw new SQLException("Not support setEscapeProcessing"); } private void checkConnection(String action) throws SQLException {
