}
stmt.executeUpdate (sql);
}
catch (SQLException sqle) {
logger.error("sql-exception", sqle);
throw new JDBCRepositoryException (sqle);
}
finally {
close(stmt);
}
// update VMPOLICY_LANG
// Resolve table name.
String vmPolicyLangTable = resolveTableName(jdbcConnection, VMPOLICY_LANG);
try {
stmt = sqlConnection.createStatement();
// resolve field names
String project = resolveFieldName(jdbcConnection, PROJECT_COLUMN_NAMES);
String policy = resolveFieldName(jdbcConnection, POLICY_COLUMN_NAMES);
String sql =
"update " + vmPolicyLangTable
+ " set " + policy + " = " + JDBCAccessorHelper.quoteValue(newPolicyName)
+ " where "
+ project + " = " + JDBCAccessorHelper.quoteValue(projectName)
+ " and " + policy + " = " + JDBCAccessorHelper.quoteValue(oldPolicyName);
if(logger.isDebugEnabled()){
logger.debug (sql);
}
stmt.executeUpdate (sql);
}
catch (SQLException sqle) {
logger.error("sql-exception", sqle);
throw new JDBCRepositoryException (sqle);
}
finally {
close(stmt);
}
// update VMPOLICY_TYPE
// Resolve table name.
String vmPolicyTypeTable = resolveTableName(jdbcConnection, VMPOLICY_TYPE);
try {
stmt = sqlConnection.createStatement();
// resolve field names
String project = resolveFieldName(jdbcConnection, PROJECT_COLUMN_NAMES);
String policy = resolveFieldName(jdbcConnection, POLICY_COLUMN_NAMES);
String sql =
"update " + vmPolicyTypeTable
+ " set " + policy + " = " + JDBCAccessorHelper.quoteValue(newPolicyName)
+ " where "
+ project + " = " + JDBCAccessorHelper.quoteValue(projectName)
+ " and " + policy + " = " + JDBCAccessorHelper.quoteValue(oldPolicyName);
if(logger.isDebugEnabled()){
logger.debug (sql);
}
stmt.executeUpdate (sql);
}
catch (SQLException sqle) {
logger.error("sql-exception", sqle);
throw new JDBCRepositoryException (sqle);
}
finally {
close(stmt);
}
}