weizhouapache commented on PR #7381:
URL: https://github.com/apache/cloudstack/pull/7381#issuecomment-1491365822
@harikrishna-patnala
I think we do not necessarily need a mysql procedure.
Refer to the following code block
```
public void dropKey(Connection conn, String tableName, String key,
boolean isForeignKey)
{
String alter_sql_str;
if (isForeignKey) {
alter_sql_str = "ALTER TABLE " + tableName + " DROP FOREIGN KEY
" + key;
} else {
alter_sql_str = "ALTER TABLE " + tableName + " DROP KEY " + key;
}
try(PreparedStatement pstmt = conn.prepareStatement(alter_sql_str);)
{
pstmt.executeUpdate();
s_logger.debug("Key " + key + " is dropped successfully from the
table " + tableName);
} catch (SQLException e) {
s_logger.debug("Ignored SQL Exception when trying to drop " +
(isForeignKey ? "foreign " : "") + "key " + key + " on table " + tableName + "
exception: " + e.getMessage());
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]