@@ -553,8 +553,6 @@ public ResultSet getProcedureColumns(String catalog, String schemaPattern, Strin
553553 return null ;
554554 }
555555
556- public abstract ResultSet getTables (String catalog , String schemaPattern , String tableNamePattern , String [] types ) throws SQLException ;
557-
558556 private List <ColumnMetaData > buildGetTablesColumnMetaDataList () {
559557 List <ColumnMetaData > columnMetaDataList = new ArrayList <>();
560558 columnMetaDataList .add (buildTableCatalogMeta (1 )); // 1. TABLE_CAT
@@ -720,15 +718,18 @@ public ResultSet getSchemas() {
720718 return getEmptyResultSet ();
721719 }
722720
723- public abstract ResultSet getCatalogs () throws SQLException ;
724-
725721 private List <ColumnMetaData > buildTableTypesColumnMetadataList () {
726722 List <ColumnMetaData > columnMetaDataList = new ArrayList <>();
727723 columnMetaDataList .add (buildTableTypeMeta (1 ));
728724 return columnMetaDataList ;
729725 }
730726
731727 public ResultSet getTableTypes () throws SQLException {
728+ Connection connection = getConnection ();
729+ if (connection == null || connection .isClosed ()) {
730+ throw TSDBError .createSQLException (TSDBErrorNumbers .ERROR_CONNECTION_CLOSED );
731+ }
732+
732733 DatabaseMetaDataResultSet resultSet = new DatabaseMetaDataResultSet ();
733734 // set up ColumnMetaDataList
734735 resultSet .setColumnMetaDataList (buildTableTypesColumnMetadataList ());
@@ -745,8 +746,6 @@ public ResultSet getTableTypes() throws SQLException {
745746 return resultSet ;
746747 }
747748
748- public abstract ResultSet getColumns (String catalog , String schemaPattern , String tableNamePattern , String columnNamePattern ) throws SQLException ;
749-
750749 private Map <String , String > getCatalogMate (Connection connection , String catalog ) throws SQLException {
751750 Map <String , String > result = new HashMap <>();
752751 try (Statement stmt = connection .createStatement ();
@@ -1382,8 +1381,6 @@ public ResultSet getVersionColumns(String catalog, String schema, String table)
13821381 return getEmptyResultSet ();
13831382 }
13841383
1385- public abstract ResultSet getPrimaryKeys (String catalog , String schema , String table ) throws SQLException ;
1386-
13871384 public ResultSet getImportedKeys (String catalog , String schema , String table ) throws SQLException {
13881385 return getEmptyResultSet ();
13891386 }
@@ -1449,7 +1446,7 @@ public boolean insertsAreDetected(int type) throws SQLException {
14491446 }
14501447
14511448 public boolean supportsBatchUpdates () throws SQLException {
1452- return false ;
1449+ return true ;
14531450 }
14541451
14551452 public ResultSet getUDTs (String catalog , String schemaPattern , String typeNamePattern , int [] types ) throws SQLException {
@@ -1477,9 +1474,6 @@ public boolean supportsGetGeneratedKeys() throws SQLException {
14771474 public ResultSet getSuperTypes (String catalog , String schemaPattern , String typeNamePattern ) throws SQLException {
14781475 return getEmptyResultSet ();
14791476 }
1480-
1481- public abstract ResultSet getSuperTables (String catalog , String schemaPattern , String tableNamePattern ) throws SQLException ;
1482-
14831477 public ResultSet getAttributes (String catalog , String schemaPattern , String typeNamePattern , String attributeNamePattern ) throws SQLException {
14841478 return getEmptyResultSet ();
14851479 }
@@ -1710,4 +1704,46 @@ private ColumnMetaData buildSuperTableNameMeta(int colIndex) {
17101704 private String generateDescribeSql (String dbName , String tableName ) throws SQLException {
17111705 return "describe " + dbName + "." + getIdentifierQuoteString () + tableName + getIdentifierQuoteString ();
17121706 }
1707+
1708+
1709+ @ Override
1710+ public ResultSet getTables (String catalog , String schemaPattern , String tableNamePattern , String [] types ) throws SQLException {
1711+ Connection connection = getConnection ();
1712+ if (connection == null || connection .isClosed ()) {
1713+ throw TSDBError .createSQLException (TSDBErrorNumbers .ERROR_CONNECTION_CLOSED );
1714+ }
1715+ return getTables (catalog , schemaPattern , tableNamePattern , types , connection );
1716+ }
1717+
1718+ @ Override
1719+ public ResultSet getCatalogs () throws SQLException {
1720+ Connection connection = getConnection ();
1721+ if (connection == null || connection .isClosed ())
1722+ throw TSDBError .createSQLException (TSDBErrorNumbers .ERROR_CONNECTION_CLOSED );
1723+ return getCatalogs (connection );
1724+ }
1725+
1726+ @ Override
1727+ public ResultSet getColumns (String catalog , String schemaPattern , String tableNamePattern , String columnNamePattern ) throws SQLException {
1728+ Connection connection = getConnection ();
1729+ if (connection == null || connection .isClosed ())
1730+ throw TSDBError .createSQLException (TSDBErrorNumbers .ERROR_CONNECTION_CLOSED );
1731+ return getColumns (catalog , schemaPattern , tableNamePattern , columnNamePattern , connection );
1732+ }
1733+
1734+ @ Override
1735+ public ResultSet getPrimaryKeys (String catalog , String schema , String table ) throws SQLException {
1736+ Connection connection = getConnection ();
1737+ if (connection == null || connection .isClosed ())
1738+ throw TSDBError .createSQLException (TSDBErrorNumbers .ERROR_CONNECTION_CLOSED );
1739+ return getPrimaryKeys (catalog , schema , table , connection );
1740+ }
1741+
1742+ @ Override
1743+ public ResultSet getSuperTables (String catalog , String schemaPattern , String tableNamePattern ) throws SQLException {
1744+ Connection connection = getConnection ();
1745+ if (connection == null || connection .isClosed ())
1746+ throw TSDBError .createSQLException (TSDBErrorNumbers .ERROR_CONNECTION_CLOSED );
1747+ return getSuperTables (catalog , schemaPattern , tableNamePattern , connection );
1748+ }
17131749}
0 commit comments