From e74d20eca2a28ab10864e53e23bee9b6aae03178 Mon Sep 17 00:00:00 2001 From: zyyang Date: Wed, 18 Nov 2020 16:08:16 +0800 Subject: [PATCH] change name --- ...Connection.java => RestfulConnection.java} | 9 +- .../jdbc/rs/RestfulDatabaseMetaData.java | 886 ++++++++++++++++++ ...sRestfulDriver.java => RestfulDriver.java} | 6 +- ...ulResultSet.java => RestfulResultSet.java} | 6 +- ...ata.java => RestfulResultSetMetaData.java} | 4 +- ...ulStatement.java => RestfulStatement.java} | 12 +- ...DriverTest.java => RestfulDriverTest.java} | 6 +- 7 files changed, 908 insertions(+), 21 deletions(-) rename src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/{TaosRestfulConnection.java => RestfulConnection.java} (95%) create mode 100644 src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java rename src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/{TaosRestfulDriver.java => RestfulDriver.java} (93%) rename src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/{TaosRestfulResultSet.java => RestfulResultSet.java} (99%) rename src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/{TaosRestfulResultSetMetaData.java => RestfulResultSetMetaData.java} (95%) rename src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/{TaosRestfulStatement.java => RestfulStatement.java} (94%) rename src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/{TaosRestfulDriverTest.java => RestfulDriverTest.java} (88%) diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulConnection.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulConnection.java similarity index 95% rename from src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulConnection.java rename to src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulConnection.java index b483c14d7a..b82efca3ef 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulConnection.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulConnection.java @@ -7,7 +7,7 @@ import java.util.Map; import java.util.Properties; import java.util.concurrent.Executor; -public class TaosRestfulConnection implements Connection { +public class RestfulConnection implements Connection { private final String host; private final int port; @@ -16,7 +16,7 @@ public class TaosRestfulConnection implements Connection { private final String url; - public TaosRestfulConnection(String host, String port, Properties props, String database, String url) { + public RestfulConnection(String host, String port, Properties props, String database, String url) { this.host = host; this.port = Integer.parseInt(port); this.props = props; @@ -28,7 +28,7 @@ public class TaosRestfulConnection implements Connection { public Statement createStatement() throws SQLException { if (isClosed()) throw new SQLException(TSDBConstants.WrapErrMsg("restful TDengine connection is closed.")); - return new TaosRestfulStatement(this, this.database); + return new RestfulStatement(this, this.database); } @Override @@ -78,7 +78,8 @@ public class TaosRestfulConnection implements Connection { @Override public DatabaseMetaData getMetaData() throws SQLException { - return null; + //TODO: RestfulDatabaseMetaData is not implemented + return new RestfulDatabaseMetaData(); } @Override diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java new file mode 100644 index 0000000000..2b4d7899fa --- /dev/null +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java @@ -0,0 +1,886 @@ +package com.taosdata.jdbc.rs; + +import java.sql.*; + +public class RestfulDatabaseMetaData implements DatabaseMetaData { + + @Override + public boolean allProceduresAreCallable() throws SQLException { + return false; + } + + @Override + public boolean allTablesAreSelectable() throws SQLException { + return false; + } + + @Override + public String getURL() throws SQLException { + return null; + } + + @Override + public String getUserName() throws SQLException { + return null; + } + + @Override + public boolean isReadOnly() throws SQLException { + return false; + } + + @Override + public boolean nullsAreSortedHigh() throws SQLException { + return false; + } + + @Override + public boolean nullsAreSortedLow() throws SQLException { + return false; + } + + @Override + public boolean nullsAreSortedAtStart() throws SQLException { + return false; + } + + @Override + public boolean nullsAreSortedAtEnd() throws SQLException { + return false; + } + + @Override + public String getDatabaseProductName() throws SQLException { + return null; + } + + @Override + public String getDatabaseProductVersion() throws SQLException { + return null; + } + + @Override + public String getDriverName() throws SQLException { + return null; + } + + @Override + public String getDriverVersion() throws SQLException { + return null; + } + + @Override + public int getDriverMajorVersion() { + return 0; + } + + @Override + public int getDriverMinorVersion() { + return 0; + } + + @Override + public boolean usesLocalFiles() throws SQLException { + return false; + } + + @Override + public boolean usesLocalFilePerTable() throws SQLException { + return false; + } + + @Override + public boolean supportsMixedCaseIdentifiers() throws SQLException { + return false; + } + + @Override + public boolean storesUpperCaseIdentifiers() throws SQLException { + return false; + } + + @Override + public boolean storesLowerCaseIdentifiers() throws SQLException { + return false; + } + + @Override + public boolean storesMixedCaseIdentifiers() throws SQLException { + return false; + } + + @Override + public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { + return false; + } + + @Override + public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { + return false; + } + + @Override + public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { + return false; + } + + @Override + public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { + return false; + } + + @Override + public String getIdentifierQuoteString() throws SQLException { + return null; + } + + @Override + public String getSQLKeywords() throws SQLException { + return null; + } + + @Override + public String getNumericFunctions() throws SQLException { + return null; + } + + @Override + public String getStringFunctions() throws SQLException { + return null; + } + + @Override + public String getSystemFunctions() throws SQLException { + return null; + } + + @Override + public String getTimeDateFunctions() throws SQLException { + return null; + } + + @Override + public String getSearchStringEscape() throws SQLException { + return null; + } + + @Override + public String getExtraNameCharacters() throws SQLException { + return null; + } + + @Override + public boolean supportsAlterTableWithAddColumn() throws SQLException { + return false; + } + + @Override + public boolean supportsAlterTableWithDropColumn() throws SQLException { + return false; + } + + @Override + public boolean supportsColumnAliasing() throws SQLException { + return false; + } + + @Override + public boolean nullPlusNonNullIsNull() throws SQLException { + return false; + } + + @Override + public boolean supportsConvert() throws SQLException { + return false; + } + + @Override + public boolean supportsConvert(int fromType, int toType) throws SQLException { + return false; + } + + @Override + public boolean supportsTableCorrelationNames() throws SQLException { + return false; + } + + @Override + public boolean supportsDifferentTableCorrelationNames() throws SQLException { + return false; + } + + @Override + public boolean supportsExpressionsInOrderBy() throws SQLException { + return false; + } + + @Override + public boolean supportsOrderByUnrelated() throws SQLException { + return false; + } + + @Override + public boolean supportsGroupBy() throws SQLException { + return false; + } + + @Override + public boolean supportsGroupByUnrelated() throws SQLException { + return false; + } + + @Override + public boolean supportsGroupByBeyondSelect() throws SQLException { + return false; + } + + @Override + public boolean supportsLikeEscapeClause() throws SQLException { + return false; + } + + @Override + public boolean supportsMultipleResultSets() throws SQLException { + return false; + } + + @Override + public boolean supportsMultipleTransactions() throws SQLException { + return false; + } + + @Override + public boolean supportsNonNullableColumns() throws SQLException { + return false; + } + + @Override + public boolean supportsMinimumSQLGrammar() throws SQLException { + return false; + } + + @Override + public boolean supportsCoreSQLGrammar() throws SQLException { + return false; + } + + @Override + public boolean supportsExtendedSQLGrammar() throws SQLException { + return false; + } + + @Override + public boolean supportsANSI92EntryLevelSQL() throws SQLException { + return false; + } + + @Override + public boolean supportsANSI92IntermediateSQL() throws SQLException { + return false; + } + + @Override + public boolean supportsANSI92FullSQL() throws SQLException { + return false; + } + + @Override + public boolean supportsIntegrityEnhancementFacility() throws SQLException { + return false; + } + + @Override + public boolean supportsOuterJoins() throws SQLException { + return false; + } + + @Override + public boolean supportsFullOuterJoins() throws SQLException { + return false; + } + + @Override + public boolean supportsLimitedOuterJoins() throws SQLException { + return false; + } + + @Override + public String getSchemaTerm() throws SQLException { + return null; + } + + @Override + public String getProcedureTerm() throws SQLException { + return null; + } + + @Override + public String getCatalogTerm() throws SQLException { + return null; + } + + @Override + public boolean isCatalogAtStart() throws SQLException { + return false; + } + + @Override + public String getCatalogSeparator() throws SQLException { + return null; + } + + @Override + public boolean supportsSchemasInDataManipulation() throws SQLException { + return false; + } + + @Override + public boolean supportsSchemasInProcedureCalls() throws SQLException { + return false; + } + + @Override + public boolean supportsSchemasInTableDefinitions() throws SQLException { + return false; + } + + @Override + public boolean supportsSchemasInIndexDefinitions() throws SQLException { + return false; + } + + @Override + public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { + return false; + } + + @Override + public boolean supportsCatalogsInDataManipulation() throws SQLException { + return false; + } + + @Override + public boolean supportsCatalogsInProcedureCalls() throws SQLException { + return false; + } + + @Override + public boolean supportsCatalogsInTableDefinitions() throws SQLException { + return false; + } + + @Override + public boolean supportsCatalogsInIndexDefinitions() throws SQLException { + return false; + } + + @Override + public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { + return false; + } + + @Override + public boolean supportsPositionedDelete() throws SQLException { + return false; + } + + @Override + public boolean supportsPositionedUpdate() throws SQLException { + return false; + } + + @Override + public boolean supportsSelectForUpdate() throws SQLException { + return false; + } + + @Override + public boolean supportsStoredProcedures() throws SQLException { + return false; + } + + @Override + public boolean supportsSubqueriesInComparisons() throws SQLException { + return false; + } + + @Override + public boolean supportsSubqueriesInExists() throws SQLException { + return false; + } + + @Override + public boolean supportsSubqueriesInIns() throws SQLException { + return false; + } + + @Override + public boolean supportsSubqueriesInQuantifieds() throws SQLException { + return false; + } + + @Override + public boolean supportsCorrelatedSubqueries() throws SQLException { + return false; + } + + @Override + public boolean supportsUnion() throws SQLException { + return false; + } + + @Override + public boolean supportsUnionAll() throws SQLException { + return false; + } + + @Override + public boolean supportsOpenCursorsAcrossCommit() throws SQLException { + return false; + } + + @Override + public boolean supportsOpenCursorsAcrossRollback() throws SQLException { + return false; + } + + @Override + public boolean supportsOpenStatementsAcrossCommit() throws SQLException { + return false; + } + + @Override + public boolean supportsOpenStatementsAcrossRollback() throws SQLException { + return false; + } + + @Override + public int getMaxBinaryLiteralLength() throws SQLException { + return 0; + } + + @Override + public int getMaxCharLiteralLength() throws SQLException { + return 0; + } + + @Override + public int getMaxColumnNameLength() throws SQLException { + return 0; + } + + @Override + public int getMaxColumnsInGroupBy() throws SQLException { + return 0; + } + + @Override + public int getMaxColumnsInIndex() throws SQLException { + return 0; + } + + @Override + public int getMaxColumnsInOrderBy() throws SQLException { + return 0; + } + + @Override + public int getMaxColumnsInSelect() throws SQLException { + return 0; + } + + @Override + public int getMaxColumnsInTable() throws SQLException { + return 0; + } + + @Override + public int getMaxConnections() throws SQLException { + return 0; + } + + @Override + public int getMaxCursorNameLength() throws SQLException { + return 0; + } + + @Override + public int getMaxIndexLength() throws SQLException { + return 0; + } + + @Override + public int getMaxSchemaNameLength() throws SQLException { + return 0; + } + + @Override + public int getMaxProcedureNameLength() throws SQLException { + return 0; + } + + @Override + public int getMaxCatalogNameLength() throws SQLException { + return 0; + } + + @Override + public int getMaxRowSize() throws SQLException { + return 0; + } + + @Override + public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { + return false; + } + + @Override + public int getMaxStatementLength() throws SQLException { + return 0; + } + + @Override + public int getMaxStatements() throws SQLException { + return 0; + } + + @Override + public int getMaxTableNameLength() throws SQLException { + return 0; + } + + @Override + public int getMaxTablesInSelect() throws SQLException { + return 0; + } + + @Override + public int getMaxUserNameLength() throws SQLException { + return 0; + } + + @Override + public int getDefaultTransactionIsolation() throws SQLException { + return 0; + } + + @Override + public boolean supportsTransactions() throws SQLException { + return false; + } + + @Override + public boolean supportsTransactionIsolationLevel(int level) throws SQLException { + return false; + } + + @Override + public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException { + return false; + } + + @Override + public boolean supportsDataManipulationTransactionsOnly() throws SQLException { + return false; + } + + @Override + public boolean dataDefinitionCausesTransactionCommit() throws SQLException { + return false; + } + + @Override + public boolean dataDefinitionIgnoredInTransactions() throws SQLException { + return false; + } + + @Override + public ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException { + return null; + } + + @Override + public ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException { + return null; + } + + @Override + public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { + return null; + } + + @Override + public ResultSet getSchemas() throws SQLException { + return null; + } + + @Override + public ResultSet getCatalogs() throws SQLException { + return null; + } + + @Override + public ResultSet getTableTypes() throws SQLException { + return null; + } + + @Override + public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { + return null; + } + + @Override + public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException { + return null; + } + + @Override + public ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { + return null; + } + + @Override + public ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException { + return null; + } + + @Override + public ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { + return null; + } + + @Override + public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { + return null; + } + + @Override + public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { + return null; + } + + @Override + public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException { + return null; + } + + @Override + public ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException { + return null; + } + + @Override + public ResultSet getTypeInfo() throws SQLException { + return null; + } + + @Override + public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException { + return null; + } + + @Override + public boolean supportsResultSetType(int type) throws SQLException { + return false; + } + + @Override + public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException { + return false; + } + + @Override + public boolean ownUpdatesAreVisible(int type) throws SQLException { + return false; + } + + @Override + public boolean ownDeletesAreVisible(int type) throws SQLException { + return false; + } + + @Override + public boolean ownInsertsAreVisible(int type) throws SQLException { + return false; + } + + @Override + public boolean othersUpdatesAreVisible(int type) throws SQLException { + return false; + } + + @Override + public boolean othersDeletesAreVisible(int type) throws SQLException { + return false; + } + + @Override + public boolean othersInsertsAreVisible(int type) throws SQLException { + return false; + } + + @Override + public boolean updatesAreDetected(int type) throws SQLException { + return false; + } + + @Override + public boolean deletesAreDetected(int type) throws SQLException { + return false; + } + + @Override + public boolean insertsAreDetected(int type) throws SQLException { + return false; + } + + @Override + public boolean supportsBatchUpdates() throws SQLException { + return false; + } + + @Override + public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException { + return null; + } + + @Override + public Connection getConnection() throws SQLException { + return null; + } + + @Override + public boolean supportsSavepoints() throws SQLException { + return false; + } + + @Override + public boolean supportsNamedParameters() throws SQLException { + return false; + } + + @Override + public boolean supportsMultipleOpenResults() throws SQLException { + return false; + } + + @Override + public boolean supportsGetGeneratedKeys() throws SQLException { + return false; + } + + @Override + public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) throws SQLException { + return null; + } + + @Override + public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { + return null; + } + + @Override + public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { + return null; + } + + @Override + public boolean supportsResultSetHoldability(int holdability) throws SQLException { + return false; + } + + @Override + public int getResultSetHoldability() throws SQLException { + return 0; + } + + @Override + public int getDatabaseMajorVersion() throws SQLException { + return 0; + } + + @Override + public int getDatabaseMinorVersion() throws SQLException { + return 0; + } + + @Override + public int getJDBCMajorVersion() throws SQLException { + return 0; + } + + @Override + public int getJDBCMinorVersion() throws SQLException { + return 0; + } + + @Override + public int getSQLStateType() throws SQLException { + return 0; + } + + @Override + public boolean locatorsUpdateCopy() throws SQLException { + return false; + } + + @Override + public boolean supportsStatementPooling() throws SQLException { + return false; + } + + @Override + public RowIdLifetime getRowIdLifetime() throws SQLException { + return null; + } + + @Override + public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException { + return null; + } + + @Override + public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { + return false; + } + + @Override + public boolean autoCommitFailureClosesAllResultSets() throws SQLException { + return false; + } + + @Override + public ResultSet getClientInfoProperties() throws SQLException { + return null; + } + + @Override + public ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) throws SQLException { + return null; + } + + @Override + public ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) throws SQLException { + return null; + } + + @Override + public ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { + return null; + } + + @Override + public boolean generatedKeyAlwaysReturned() throws SQLException { + return false; + } + + @Override + public T unwrap(Class iface) throws SQLException { + return null; + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + return false; + } +} diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulDriver.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java similarity index 93% rename from src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulDriver.java rename to src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java index c69193a43c..c267f660de 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulDriver.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java @@ -11,13 +11,13 @@ import java.sql.*; import java.util.Properties; import java.util.logging.Logger; -public class TaosRestfulDriver extends AbstractTaosDriver { +public class RestfulDriver extends AbstractTaosDriver { private static final String URL_PREFIX = "jdbc:TAOS-RS://"; static { try { - DriverManager.registerDriver(new TaosRestfulDriver()); + DriverManager.registerDriver(new RestfulDriver()); } catch (SQLException e) { throw new RuntimeException(TSDBConstants.WrapErrMsg("can not register Restful JDBC driver"), e); } @@ -48,7 +48,7 @@ public class TaosRestfulDriver extends AbstractTaosDriver { throw new SQLException(jsonResult.getString("desc")); } - return new TaosRestfulConnection(host, port, props, database, url); + return new RestfulConnection(host, port, props, database, url); } @Override diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulResultSet.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java similarity index 99% rename from src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulResultSet.java rename to src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java index bc88be243f..c536ae4a89 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulResultSet.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java @@ -13,13 +13,13 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Map; -public class TaosRestfulResultSet implements ResultSet { +public class RestfulResultSet implements ResultSet { private boolean isClosed = false; private int pos = -1; private ArrayList> data; private ArrayList fields; - public TaosRestfulResultSet(String str, String fieldData) { + public RestfulResultSet(String str, String fieldData) { data = new ArrayList<>(); str = str.substring(2, str.length() - 2); ArrayList strTemp = new ArrayList<>(Arrays.asList(str.split("],\\["))); @@ -262,7 +262,7 @@ public class TaosRestfulResultSet implements ResultSet { @Override public ResultSetMetaData getMetaData() throws SQLException { - return new TaosRestfulResultSetMetaData(fields); + return new RestfulResultSetMetaData(fields); } @Override diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulResultSetMetaData.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSetMetaData.java similarity index 95% rename from src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulResultSetMetaData.java rename to src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSetMetaData.java index 06ca9ad298..5dd61391bc 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulResultSetMetaData.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSetMetaData.java @@ -4,11 +4,11 @@ import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.List; -public class TaosRestfulResultSetMetaData implements ResultSetMetaData { +public class RestfulResultSetMetaData implements ResultSetMetaData { private List fields; - public TaosRestfulResultSetMetaData(List fields) { + public RestfulResultSetMetaData(List fields) { this.fields = fields; } diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulStatement.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java similarity index 94% rename from src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulStatement.java rename to src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java index 214a370081..20510f0135 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/TaosRestfulStatement.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java @@ -9,12 +9,12 @@ import java.sql.*; import java.util.Arrays; import java.util.List; -public class TaosRestfulStatement implements Statement { +public class RestfulStatement implements Statement { private final String catalog; - private final TaosRestfulConnection conn; + private final RestfulConnection conn; - public TaosRestfulStatement(TaosRestfulConnection c, String catalog) { + public RestfulStatement(RestfulConnection c, String catalog) { this.conn = c; this.catalog = catalog; } @@ -46,12 +46,12 @@ public class TaosRestfulStatement implements Statement { } String dataStr = jsonObject.getString("data"); if ("use".equalsIgnoreCase(fields.split(" ")[0])) { - return new TaosRestfulResultSet(dataStr, ""); + return new RestfulResultSet(dataStr, ""); } JSONObject jsonField = JSON.parseObject(fields); if (jsonField == null) { - return new TaosRestfulResultSet(dataStr, ""); + return new RestfulResultSet(dataStr, ""); } if (jsonField.getString("status").equals("error")) { throw new SQLException(TSDBConstants.WrapErrMsg("SQL execution error: " + @@ -60,7 +60,7 @@ public class TaosRestfulStatement implements Statement { } String fieldData = jsonField.getString("data"); - return new TaosRestfulResultSet(dataStr, fieldData); + return new RestfulResultSet(dataStr, fieldData); } @Override diff --git a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/TaosRestfulDriverTest.java b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java similarity index 88% rename from src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/TaosRestfulDriverTest.java rename to src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java index d641c69f27..a91d1c2d6b 100644 --- a/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/TaosRestfulDriverTest.java +++ b/src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java @@ -5,12 +5,12 @@ import org.junit.Test; import java.sql.*; -public class TaosRestfulDriverTest { +public class RestfulDriverTest { @Test public void testCase001() { try { - Class.forName("com.taosdata.jdbc.rs.TaosRestfulDriver"); + Class.forName("com.taosdata.jdbc.rs.RestfulDriver"); Connection connection = DriverManager.getConnection("jdbc:TAOS-RS://master:6041/?user=root&password=taosdata"); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("select * from log.log"); @@ -32,7 +32,7 @@ public class TaosRestfulDriverTest { @Test public void testAcceptUrl() throws SQLException { - Driver driver = new TaosRestfulDriver(); + Driver driver = new RestfulDriver(); boolean isAccept = driver.acceptsURL("jdbc:TAOS-RS://master:6041"); Assert.assertTrue(isAccept); } -- GitLab