@@ -39,25 +39,26 @@ public void dropKey(Connection conn, String tableName, String key, boolean isFor
3939 pstmt .executeUpdate ();
4040 s_logger .debug ("Key " + key + " is dropped successfully from the table " + tableName );
4141 } catch (SQLException e ) {
42- s_logger .warn ("dropKey:Exception:" +e .getMessage ());
42+ s_logger .warn ("Ignored SQL Exception when trying to drop " + (isForeignKey ? "foreign " : "" ) + "key " + key + " on table " + tableName , e );
43+
4344 }
4445 }
4546
4647 public void dropPrimaryKey (Connection conn , String tableName ) {
4748 try (PreparedStatement pstmt = conn .prepareStatement ("ALTER TABLE " + tableName + " DROP PRIMARY KEY " );) {
4849 pstmt .executeUpdate ();
4950 s_logger .debug ("Primary key is dropped successfully from the table " + tableName );
50- } catch (Exception e ) {
51- s_logger .warn ("dropPrimaryKey: Exception:" + e . getMessage () );
51+ } catch (SQLException e ) {
52+ s_logger .warn ("Ignored SQL Exception when trying to drop primary key on table " + tableName , e );
5253 }
5354 }
5455
5556 public void dropColumn (Connection conn , String tableName , String columnName ) {
5657 try (PreparedStatement pstmt = conn .prepareStatement ("ALTER TABLE " + tableName + " DROP COLUMN " + columnName );){
5758 pstmt .executeUpdate ();
5859 s_logger .debug ("Column " + columnName + " is dropped successfully from the table " + tableName );
59- } catch (Exception e ) {
60- s_logger .warn ("dropColumn:Exception:" + e . getMessage () );
60+ } catch (SQLException e ) {
61+ s_logger .warn ("Unable to drop column " + columnName + " due to exception" , e );
6162 }
6263 }
6364
@@ -66,8 +67,8 @@ public boolean columnExists(Connection conn, String tableName, String columnName
6667 try (PreparedStatement pstmt = conn .prepareStatement ("SELECT " + columnName + " FROM " + tableName );){
6768 pstmt .executeQuery ();
6869 columnExists = true ;
69- } catch (Exception e ) {
70- s_logger .warn ("columnExists:Exception:" + e . getMessage () );
70+ } catch (SQLException e ) {
71+ s_logger .warn ("Field " + columnName + " doesn't exist in " + tableName , e );
7172 }
7273 return columnExists ;
7374 }
0 commit comments