diff --git a/projects/samskivert/src/java/com/samskivert/jdbc/JDBCUtil.java b/projects/samskivert/src/java/com/samskivert/jdbc/JDBCUtil.java index b9c5627b..c1528902 100644 --- a/projects/samskivert/src/java/com/samskivert/jdbc/JDBCUtil.java +++ b/projects/samskivert/src/java/com/samskivert/jdbc/JDBCUtil.java @@ -375,6 +375,26 @@ public class JDBCUtil "' modified to have this def '" + cdef + "'."); } + /** + * Removes a column from the specified table. + */ + public static void dropColumn (Connection conn, String table, String cname) + throws SQLException + { + String update = "ALTER TABLE " + table + " DROP COLUMN " + cname; + + PreparedStatement stmt = null; + try { + stmt = conn.prepareStatement(update); + if (stmt.executeUpdate() == 1) { + Log.info("Database index '" + cname + "' removed from " + + "table '" + table + "'."); + } + } finally { + close(stmt); + } + } + /** * Removes a named index from the specified table. */ @@ -394,7 +414,7 @@ public class JDBCUtil close(stmt); } } - + /** * Removes the primary key from the specified table. */