Example #1
0
  public static ResultSet executeSql(final Statement statement, final String sql) {
    ResultSet results = null;
    if (statement == null) {
      return results;
    }
    if (isBlank(sql)) {
      LOGGER.log(Level.FINE, "No SQL provided", new RuntimeException());
      return results;
    }

    try {
      statement.clearWarnings();

      final boolean hasResults = statement.execute(sql);
      if (hasResults) {
        results = statement.getResultSet();
      } else {
        final int updateCount = statement.getUpdateCount();
        LOGGER.log(
            Level.FINE,
            String.format("No results. Update count of %d for query: %s", updateCount, sql));
      }

      SQLWarning sqlWarning = statement.getWarnings();
      while (sqlWarning != null) {
        LOGGER.log(Level.INFO, sqlWarning.getMessage(), sqlWarning);
        sqlWarning = sqlWarning.getNextWarning();
      }

      return results;
    } catch (final SQLException e) {
      LOGGER.log(Level.WARNING, "Error executing: " + sql, e);
      return null;
    }
  }
  public static void ShowWarnings(PrintStream out, Statement s) {
    try {
      // GET STATEMENT WARNINGS
      SQLWarning warning = null;

      if (s != null) {
        ShowWarnings(out, s.getWarnings());
      }

      if (s != null) {
        s.clearWarnings();
      }
    } catch (SQLException e) {
      ShowSQLException(out, e);
    }
  } // ShowStatementWarnings
Example #3
0
 /** @see java.sql.Statement#clearWarnings() */
 public void clearWarnings() throws SQLException {
   clusterCall("clearWarnings", null, null, true);
   st.clearWarnings();
 }
Example #4
0
 @Override
 public void clearWarnings() throws SQLException {
   stat.clearWarnings();
 }
Example #5
0
 public void clearWarnings() throws SQLException {
   pst.clearWarnings();
 };
 @Override
 public void clearWarnings() throws SQLException {
   rawStatement.clearWarnings();
 }