MCPcopy Index your code
hub / github.com/apache/groovy / execute

Method execute

subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java:2638–2653  ·  view source on GitHub ↗

Executes the given piece of SQL. Also saves the updateCount, if any, for subsequent examination. Example usages: sql.execute "DROP TABLE IF EXISTS person" sql.execute """ CREATE TABLE person ( id INTEGER NOT NULL, firstname VARCHAR(100), lastname VARCHAR(100),

(String sql)

Source from the content-addressed store, hash-verified

2636 * @throws SQLException if a database access error occurs
2637 */
2638 public boolean execute(String sql) throws SQLException {
2639 Connection connection = createConnection();
2640 Statement statement = null;
2641 try {
2642 statement = getStatement(connection, sql);
2643 boolean isResultSet = statement.execute(sql);
2644 this.updateCount = statement.getUpdateCount();
2645 cleanup(statement);
2646 return isResultSet;
2647 } catch (SQLException e) {
2648 LOG.warning("Failed to execute: " + sql + " because: " + e.getMessage());
2649 throw e;
2650 } finally {
2651 closeResources(connection, statement);
2652 }
2653 }
2654
2655 /**
2656 * Executes the given piece of SQL.

Callers 3

mainMethod · 0.45
callWithRowsMethod · 0.45
getAbstractStatementMethod · 0.45

Calls 14

createConnectionMethod · 0.95
getStatementMethod · 0.95
cleanupMethod · 0.95
closeResourcesMethod · 0.95
asListMethod · 0.95
getPreparedStatementMethod · 0.95
singletonListMethod · 0.95
getParametersMethod · 0.95
asSqlMethod · 0.95
getUpdateCountMethod · 0.80
callMethod · 0.65
getMessageMethod · 0.45

Tested by 1

mainMethod · 0.36