@Test public void testCreateTable() throws Exception { TestDatabaseListener listener = new TestDatabaseListener(dbConnectionInfo, "INSERT INTO DUMMY_TABLE (col1, col2, col3) values (?, ?, ?)") .setBatchSize(2) .setValidateConnectionEachBatch(false); assertNotNull(listener); HashMap<String, String> colMap = new HashMap<String, String>(2); colMap.put("id", "integer"); colMap.put("note", "varchar(1000)"); listener.createTable(false, "PUBLIC", "create_test_table", colMap); ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM create_test_table"); assertNotNull(rs); int numCols = rs.getMetaData().getColumnCount(); assertEquals(2, numCols); assertEquals(2, listener.getBatchSize()); }
public void createTable(String createStatement, boolean dropFirst, String tableName) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException { validateConnection(); if (dropFirst && StringUtils.isNotBlank(tableName)) { conn.createStatement().execute("DROP TABLE " + tableName); } conn.createStatement().execute(createStatement); }
BaseDatabaseListener extends BaseListener { public void createTable(String createStatement, boolean dropFirst, String tableName) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException { validateConnection(); if (dropFirst && StringUtils.isNotBlank(tableName)) { conn.createStatement().execute("DROP TABLE " + tableName); } conn.createStatement().execute(createStatement); } }
BaseDatabaseListener extends BaseListener { public void createTable(String createStatement, boolean dropFirst, String tableName) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException { validateConnection(); if (dropFirst && StringUtils.isNotBlank(tableName)) { conn.createStatement().execute("DROP TABLE " + tableName); } conn.createStatement().execute(createStatement); } BaseDatabaseListener(DatabaseConnectionInformation databaseConnectionInformation, String databaseName, String databaseTable,  List<DatabaseField> fieldList);  BaseDatabaseListener(DatabaseConnectionInformation databaseConnectionInformation, String preparedStatementSQL); }
BaseDatabaseListener extends BaseListener { public void createTable(String createStatement, boolean dropFirst, String tableName) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException { validateConnection(); if (dropFirst && StringUtils.isNotBlank(tableName)) { conn.createStatement().execute("DROP TABLE " + tableName); } conn.createStatement().execute(createStatement); } BaseDatabaseListener(DatabaseConnectionInformation databaseConnectionInformation, String databaseName, String databaseTable,  List<DatabaseField> fieldList);  BaseDatabaseListener(DatabaseConnectionInformation databaseConnectionInformation, String preparedStatementSQL); boolean isValidateConnectionEachBatch(); T setValidateConnectionEachBatch(boolean validateConnectionEachBatch); int getBatchSize(); T setBatchSize(int batchSize); @Override void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus); @Override void collectionProcessComplete(EntityProcessStatus aStatus); void createTable(String createStatement, boolean dropFirst, String tableName); void createTable(boolean dropFirst,
                            String dbsName,
                            String tableName,
                            Map<String, String> fieldList
    ); void createTable(boolean dropFirst,
                            String dbsName,
                            String tableName,
                            List<DatabaseField> fieldList
    ); }
BaseDatabaseListener extends BaseListener { public void createTable(String createStatement, boolean dropFirst, String tableName) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException { validateConnection(); if (dropFirst && StringUtils.isNotBlank(tableName)) { conn.createStatement().execute("DROP TABLE " + tableName); } conn.createStatement().execute(createStatement); } BaseDatabaseListener(DatabaseConnectionInformation databaseConnectionInformation, String databaseName, String databaseTable,  List<DatabaseField> fieldList);  BaseDatabaseListener(DatabaseConnectionInformation databaseConnectionInformation, String preparedStatementSQL); boolean isValidateConnectionEachBatch(); T setValidateConnectionEachBatch(boolean validateConnectionEachBatch); int getBatchSize(); T setBatchSize(int batchSize); @Override void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus); @Override void collectionProcessComplete(EntityProcessStatus aStatus); void createTable(String createStatement, boolean dropFirst, String tableName); void createTable(boolean dropFirst,
                            String dbsName,
                            String tableName,
                            Map<String, String> fieldList
    ); void createTable(boolean dropFirst,
                            String dbsName,
                            String tableName,
                            List<DatabaseField> fieldList
    );  }