@Test public void testProcessPublish() throws VantiqSQLException { assumeTrue(testDBUsername != null && testDBPassword != null && testDBURL != null && jdbcDriverLoc != null); jdbc.setupJDBC(testDBURL, testDBUsername, testDBPassword, false, 0); int queryResult; try { queryResult = jdbc.processPublish("jibberish"); fail("Should have thrown an exception"); } catch (VantiqSQLException e) { } try { queryResult = jdbc.processPublish(CREATE_TABLE); assert queryResult == 0; } catch (VantiqSQLException e) { fail("Should not throw an exception: " + e.getMessage()); } try { queryResult = jdbc.processPublish(PUBLISH_QUERY); assert queryResult > 0; } catch (VantiqSQLException e) { fail("Should not throw an exception: " + e.getMessage()); } jdbc.close(); }
public int processPublish(String sqlQuery) throws VantiqSQLException { int publishSuccess = -1; if (isAsync) { try (Connection conn = ds.getConnection(); Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } else { diagnoseConnection(); try (Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } return publishSuccess; }
JDBC { public int processPublish(String sqlQuery) throws VantiqSQLException { int publishSuccess = -1; if (isAsync) { try (Connection conn = ds.getConnection(); Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } else { diagnoseConnection(); try (Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } return publishSuccess; } }
JDBC { public int processPublish(String sqlQuery) throws VantiqSQLException { int publishSuccess = -1; if (isAsync) { try (Connection conn = ds.getConnection(); Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } else { diagnoseConnection(); try (Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } return publishSuccess; }  }
JDBC { public int processPublish(String sqlQuery) throws VantiqSQLException { int publishSuccess = -1; if (isAsync) { try (Connection conn = ds.getConnection(); Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } else { diagnoseConnection(); try (Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } return publishSuccess; }  void setupJDBC(String dbURL, String username, String password, boolean asyncProcessing, int maxPoolSize); HashMap[] processQuery(String sqlQuery); int processPublish(String sqlQuery); int[] processBatchPublish(List queryList); void diagnoseConnection(); void reportSQLError(SQLException e); void close(); }
JDBC { public int processPublish(String sqlQuery) throws VantiqSQLException { int publishSuccess = -1; if (isAsync) { try (Connection conn = ds.getConnection(); Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } else { diagnoseConnection(); try (Statement stmt = conn.createStatement()) { publishSuccess = stmt.executeUpdate(sqlQuery); } catch (SQLException e) { reportSQLError(e); } } return publishSuccess; }  void setupJDBC(String dbURL, String username, String password, boolean asyncProcessing, int maxPoolSize); HashMap[] processQuery(String sqlQuery); int processPublish(String sqlQuery); int[] processBatchPublish(List queryList); void diagnoseConnection(); void reportSQLError(SQLException e); void close();  }