use of com.axway.ats.core.dbaccess.exceptions.DbException in project ats-framework by Axway.
the class DatabaseOperations method updateValue.
/**
* Run update query.
*
* @param sqlQuery the SQL query to run
* @return the number of updated rows
*/
@PublicAtsApi
public int updateValue(String sqlQuery) {
int rowsUpdated;
try {
log.debug("Executing update query: '" + sqlQuery + "'");
rowsUpdated = dbProvider.executeUpdate(sqlQuery);
if (!(dbProvider instanceof CassandraDbProvider)) {
if (rowsUpdated == 0) {
log.warn("SQL query '" + sqlQuery + "' updated 0 rows");
} else {
log.debug("SQL query '" + sqlQuery + "' updated '" + rowsUpdated + "' rows");
}
}
} catch (DbException e) {
throw new DatabaseOperationsException("Error executing update query '" + sqlQuery + "'", e);
}
return rowsUpdated;
}
Aggregations