提交 e56abac7 编写于 作者: Z zyyang

change

上级 0f9ad76f
...@@ -981,9 +981,7 @@ public abstract class AbstractDatabaseMetaData implements DatabaseMetaData, Wrap ...@@ -981,9 +981,7 @@ public abstract class AbstractDatabaseMetaData implements DatabaseMetaData, Wrap
return getEmptyResultSet(); return getEmptyResultSet();
} }
public Connection getConnection() throws SQLException { public abstract Connection getConnection() throws SQLException;
return null;
}
public boolean supportsSavepoints() throws SQLException { public boolean supportsSavepoints() throws SQLException {
return false; return false;
......
package com.taosdata.jdbc.rs; package com.taosdata.jdbc.rs;
import com.taosdata.jdbc.AbstractDatabaseMetaData; import com.taosdata.jdbc.AbstractDatabaseMetaData;
import com.taosdata.jdbc.TSDBConstants; import com.taosdata.jdbc.TSDBError;
import com.taosdata.jdbc.TSDBErrorNumbers;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
...@@ -34,11 +35,10 @@ public class RestfulDatabaseMetaData extends AbstractDatabaseMetaData { ...@@ -34,11 +35,10 @@ public class RestfulDatabaseMetaData extends AbstractDatabaseMetaData {
return RestfulDriver.class.getName(); return RestfulDriver.class.getName();
} }
@Override @Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException {
if (connection == null || connection.isClosed()) { if (connection == null || connection.isClosed()) {
throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL)); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED);
} }
return super.getTables(catalog, schemaPattern, tableNamePattern, types, connection); return super.getTables(catalog, schemaPattern, tableNamePattern, types, connection);
} }
...@@ -46,14 +46,14 @@ public class RestfulDatabaseMetaData extends AbstractDatabaseMetaData { ...@@ -46,14 +46,14 @@ public class RestfulDatabaseMetaData extends AbstractDatabaseMetaData {
@Override @Override
public ResultSet getCatalogs() throws SQLException { public ResultSet getCatalogs() throws SQLException {
if (connection == null || connection.isClosed()) if (connection == null || connection.isClosed())
throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL)); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED);
return super.getCatalogs(connection); return super.getCatalogs(connection);
} }
@Override @Override
public ResultSet getTableTypes() throws SQLException { public ResultSet getTableTypes() throws SQLException {
if (connection == null || connection.isClosed()) { if (connection == null || connection.isClosed()) {
throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL)); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED);
} }
return super.getTableTypes(); return super.getTableTypes();
} }
...@@ -61,21 +61,26 @@ public class RestfulDatabaseMetaData extends AbstractDatabaseMetaData { ...@@ -61,21 +61,26 @@ public class RestfulDatabaseMetaData extends AbstractDatabaseMetaData {
@Override @Override
public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
if (connection == null || connection.isClosed()) if (connection == null || connection.isClosed())
throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL)); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED);
return super.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern, connection); return super.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern, connection);
} }
@Override @Override
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
if (connection == null || connection.isClosed()) if (connection == null || connection.isClosed())
throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL)); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED);
return super.getPrimaryKeys(catalog, schema, table, connection); return super.getPrimaryKeys(catalog, schema, table, connection);
} }
@Override
public Connection getConnection() throws SQLException {
return this.connection;
}
@Override @Override
public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException {
if (connection == null || connection.isClosed()) if (connection == null || connection.isClosed())
throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL)); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED);
return super.getSuperTables(catalog, schemaPattern, tableNamePattern, connection); return super.getSuperTables(catalog, schemaPattern, tableNamePattern, connection);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册