I've got the fever, I can't stop making the repositories more convenient.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1654 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -198,26 +198,26 @@ public class SimpleRepository extends Repository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the supplied update query in this repository, ignoring the
|
* Executes the supplied update query in this repository, returning
|
||||||
* return value.
|
* the number of rows modified.
|
||||||
*/
|
*/
|
||||||
protected void update (final String query)
|
protected int update (final String query)
|
||||||
throws PersistenceException
|
throws PersistenceException
|
||||||
{
|
{
|
||||||
execute(new Operation() {
|
Integer rv = (Integer)execute(new Operation() {
|
||||||
public Object invoke (Connection conn, DatabaseLiaison liaison)
|
public Object invoke (Connection conn, DatabaseLiaison liaison)
|
||||||
throws SQLException, PersistenceException
|
throws SQLException, PersistenceException
|
||||||
{
|
{
|
||||||
Statement stmt = null;
|
Statement stmt = null;
|
||||||
try {
|
try {
|
||||||
stmt = conn.createStatement();
|
stmt = conn.createStatement();
|
||||||
stmt.executeUpdate(query);
|
return new Integer(stmt.executeUpdate(query));
|
||||||
} finally {
|
} finally {
|
||||||
JDBCUtil.close(stmt);
|
JDBCUtil.close(stmt);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return rv.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user