@Test public void testListDatabases() throws SQLException { when(connection.getCatalog()).thenReturn("catalog1"); List<String> dbs = jdbcMetadata.listDatabases(); Assert.assertEquals(1, dbs.size()); Assert.assertEquals("catalog1", dbs.get(0)); }
@Override public List<String> listDatabases() throws SQLException { List<String> ret = new ArrayList<>(); try (Connection con = SqlUtil.getConnection(dbconf)) { ret.add(con.getCatalog()); } return ret; }
MySQLJdbcMetadata extends DefaultJdbcMetadata { @Override public List<String> listDatabases() throws SQLException { List<String> ret = new ArrayList<>(); try (Connection con = SqlUtil.getConnection(dbconf)) { ret.add(con.getCatalog()); } return ret; } }
MySQLJdbcMetadata extends DefaultJdbcMetadata { @Override public List<String> listDatabases() throws SQLException { List<String> ret = new ArrayList<>(); try (Connection con = SqlUtil.getConnection(dbconf)) { ret.add(con.getCatalog()); } return ret; } MySQLJdbcMetadata(DBConnConf dbConnConf); }
MySQLJdbcMetadata extends DefaultJdbcMetadata { @Override public List<String> listDatabases() throws SQLException { List<String> ret = new ArrayList<>(); try (Connection con = SqlUtil.getConnection(dbconf)) { ret.add(con.getCatalog()); } return ret; } MySQLJdbcMetadata(DBConnConf dbConnConf); @Override List<String> listDatabases(); @Override List<String> listTables(String catalog); @Override ResultSet listColumns(final DatabaseMetaData dbmd, String catalog, String table); @Override ResultSet getTable(final DatabaseMetaData dbmd, String catalog, String table); @Override SourceDialect getDialect(); }
MySQLJdbcMetadata extends DefaultJdbcMetadata { @Override public List<String> listDatabases() throws SQLException { List<String> ret = new ArrayList<>(); try (Connection con = SqlUtil.getConnection(dbconf)) { ret.add(con.getCatalog()); } return ret; } MySQLJdbcMetadata(DBConnConf dbConnConf); @Override List<String> listDatabases(); @Override List<String> listTables(String catalog); @Override ResultSet listColumns(final DatabaseMetaData dbmd, String catalog, String table); @Override ResultSet getTable(final DatabaseMetaData dbmd, String catalog, String table); @Override SourceDialect getDialect();  }