/** * Performs a stored procedure call with the given embedded parameters. * <p> * Example usage - see {@link #call(String)} for more details about * creating a <code>HouseSwap(IN name1, IN name2)</code> stored procedure. * Once created, it can be called like this: * <pre> * def p1 = 'Paul' * def p2 = 'Guillaume' * def rowsChanged = sql.call("{call HouseSwap($p1, $p2)}") * assert rowsChanged == 2 * </pre> * <p> * Resource handling is performed automatically where appropriate. * * @param gstring a GString containing the SQL query with embedded params * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs * @see #expand(Object) * @see #call(String) */ public int call(GString gstring) throws Exception { List<Object> params = getParameters(gstring); String sql = asSql(gstring, params); return call(sql, params); }
/** * Performs a stored procedure call. * * @param sql the SQL statement * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs */ public int call(String sql) throws Exception { return call(sql, Collections.EMPTY_LIST); }
/** * Performs a stored procedure call. * * @param sql the SQL statement * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs */ public int call(String sql) throws Exception { return call(sql, Collections.EMPTY_LIST); }
def sessionFactory //after GORM saves... sessionFactory.currentSession.flush() Sql s = new Sql( sessionFactory.currentSession.connection() ) s.call()
/** * Performs a stored procedure call with the given parameters. * <p> * An Object array variant of {@link #call(String, List)}. * * @param sql the SQL statement * @param params an array of parameters * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs * @see #call(String) */ public int call(String sql, Object[] params) throws Exception { return call(sql, Arrays.asList(params)); }
/** * Performs a stored procedure call with the given parameters. * <p/> * An Object array variant of {@link #call(String, List)}. * * @param sql the SQL statement * @param params an array of parameters * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs * @see #call(String) */ public int call(String sql, Object[] params) throws Exception { return call(sql, Arrays.asList(params)); }
return call(sql, EMPTY_LIST);
return call(sql, EMPTY_LIST);
return call(sql, EMPTY_LIST);
/** * Performs a stored procedure call with the given parameters. * * @param gstring a GString containing the SQL query with embedded params * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs */ public int call(GString gstring) throws Exception { List params = getParameters(gstring); String sql = asSql(gstring, params); return call(sql, params); }
/** * Performs a stored procedure call with the given parameters, * calling the closure once with all result objects. * * @param gstring a GString containing the SQL query with embedded params * @param closure called for each row with a GroovyResultSet * @throws SQLException if a database access error occurs */ public void call(GString gstring, Closure closure) throws Exception { List params = getParameters(gstring); String sql = asSql(gstring, params); call(sql, params, closure); }
/** * Performs a stored procedure call with the given parameters. * * @param gstring a GString containing the SQL query with embedded params * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs */ public int call(GString gstring) throws Exception { List params = getParameters(gstring); String sql = asSql(gstring, params); return call(sql, params); }
/** * Performs a stored procedure call with the given parameters, * calling the closure once with all result objects. * * @param gstring a GString containing the SQL query with embedded params * @param closure called for each row with a GroovyResultSet * @throws SQLException if a database access error occurs */ public void call(GString gstring, Closure closure) throws Exception { List params = getParameters(gstring); String sql = asSql(gstring, params); call(sql, params, closure); }
/** * Performs a stored procedure call with the given embedded parameters. * <p/> * Example usage - see {@link #call(String)} for more details about * creating a <code>HouseSwap(IN name1, IN name2)</code> stored procedure. * Once created, it can be called like this: * <pre> * def p1 = 'Paul' * def p2 = 'Guillaume' * def rowsChanged = sql.call("{call HouseSwap($p1, $p2)}") * assert rowsChanged == 2 * </pre> * * @param gstring a GString containing the SQL query with embedded params * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs * @see #expand(Object) * @see #call(String) */ public int call(GString gstring) throws Exception { List<Object> params = getParameters(gstring); String sql = asSql(gstring, params); return call(sql, params); }
/** * Performs a stored procedure call with the given embedded parameters. * <p/> * Example usage - see {@link #call(String)} for more details about * creating a <code>HouseSwap(IN name1, IN name2)</code> stored procedure. * Once created, it can be called like this: * <pre> * def p1 = 'Paul' * def p2 = 'Guillaume' * def rowsChanged = sql.call("{call HouseSwap($p1, $p2)}") * assert rowsChanged == 2 * </pre> * <p/> * Resource handling is performed automatically where appropriate. * * @param gstring a GString containing the SQL query with embedded params * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs * @see #expand(Object) * @see #call(String) */ public int call(GString gstring) throws Exception { List<Object> params = getParameters(gstring); String sql = asSql(gstring, params); return call(sql, params); }
/** * Performs a stored procedure call with the given embedded parameters. * <p> * Example usage - see {@link #call(String)} for more details about * creating a <code>HouseSwap(IN name1, IN name2)</code> stored procedure. * Once created, it can be called like this: * <pre> * def p1 = 'Paul' * def p2 = 'Guillaume' * def rowsChanged = sql.call("{call HouseSwap($p1, $p2)}") * assert rowsChanged == 2 * </pre> * <p> * Resource handling is performed automatically where appropriate. * * @param gstring a GString containing the SQL query with embedded params * @return the number of rows updated or 0 for SQL statements that return nothing * @throws SQLException if a database access error occurs * @see #expand(Object) * @see #call(String) */ public int call(GString gstring) throws Exception { List<Object> params = getParameters(gstring); String sql = asSql(gstring, params); return call(sql, params); }
List<Object> params = getParameters(gstring); String sql = asSql(gstring, params); call(sql, params, closure);
List<Object> params = getParameters(gstring); String sql = asSql(gstring, params); call(sql, params, closure);
List<Object> params = getParameters(gstring); String sql = asSql(gstring, params); call(sql, params, closure);