Added drop column.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1636 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -375,6 +375,26 @@ public class JDBCUtil
|
|||||||
"' modified to have this def '" + cdef + "'.");
|
"' 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.
|
* Removes a named index from the specified table.
|
||||||
*/
|
*/
|
||||||
@@ -394,7 +414,7 @@ public class JDBCUtil
|
|||||||
close(stmt);
|
close(stmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the primary key from the specified table.
|
* Removes the primary key from the specified table.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user