Added warnedUpdate to the SimpleRepository

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2075 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mjohnson
2007-03-21 23:00:21 +00:00
parent e038506fc5
commit 927d8c3336
@@ -3,7 +3,7 @@
// //
// samskivert library - useful routines for java programs // samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne // Copyright (C) 2001 Michael Bayne
// //
// This library is free software; you can redistribute it and/or modify it // This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published // under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or // by the Free Software Foundation; either version 2.1 of the License, or
@@ -311,6 +311,29 @@ public class SimpleRepository extends Repository
}); });
} }
/**
* Executes the supplied update query in this repository, logging a warning
* if the modification count is not equal to the specified count.
*/
protected void warnedUpdate (final String query, final int count)
throws PersistenceException
{
executeUpdate(new Operation<Object>() {
public Object invoke (Connection conn, DatabaseLiaison liaison)
throws SQLException, PersistenceException
{
Statement stmt = null;
try {
stmt = conn.createStatement();
JDBCUtil.warnedUpdate(stmt, query, 1);
} finally {
JDBCUtil.close(stmt);
}
return null;
}
});
}
/** /**
* Instructs MySQL to perform table maintenance on the specified * Instructs MySQL to perform table maintenance on the specified
* table. * table.