MCPcopy Create free account
hub / github.com/boxbeam/RedLib / prepareStatement

Method prepareStatement

src/redempt/redlib/sql/SQLHelper.java:475–488  ·  view source on GitHub ↗

Prepares a statement, setting its fields to the elements of the vararg passed @param query The SQL query to prepare @param fields A vararg of the fields to set in the prepared statement @return The PreparedStatement with its fields set

(String query, Object... fields)

Source from the content-addressed store, hash-verified

473 * @return The PreparedStatement with its fields set
474 */
475 public PreparedStatement prepareStatement(String query, Object... fields) {
476 try {
477 PreparedStatement statement = connection.prepareStatement(query);
478 int i = 1;
479 for (Object object : fields) {
480 statement.setObject(i, object);
481 i++;
482 }
483 return statement;
484 } catch (SQLException e) {
485 sneakyThrow(e);
486 return null;
487 }
488 }
489
490 /**
491 * Closes the underlying connection this SQLHelper wraps

Callers 9

executeMethod · 0.95
executeUpdateMethod · 0.95
querySingleResultMethod · 0.95
querySingleResultLongMethod · 0.95
queryResultListMethod · 0.95
queryResultStringListMethod · 0.95
queryResultsMethod · 0.95

Calls 1

sneakyThrowMethod · 0.95

Tested by

no test coverage detected