protected void flushAndUpdate(RowImpl row) throws SQLException {
// prepare statement
String sql = row.getSQL(_dict);
PreparedStatement stmnt = prepareStatement(sql);
// setup parameters and execute statement
if (stmnt != null)
row.flush(stmnt, _dict, _store);
try {
int count = executeUpdate(stmnt, sql, row);
if (count != 1) {
Object failed = row.getFailedObject();
if (failed != null)
_exceptions.add(new OptimisticException(failed));
else if (row.getAction() == Row.ACTION_INSERT)
throw new SQLException(_loc.get(
"update-failed-no-failed-obj", String.valueOf(count),
sql).getMessage());
}
} catch (SQLException se) {
throw SQLExceptions.getStore(se, row.getFailedObject(), _dict);
} finally {
if (stmnt != null) {
try {
stmnt.close();
} catch (SQLException se) {
}
}
}
}
Flush the given row immediately. |