Let DatabaseLiaisons know how to drop tables.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2527 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
par.winzell
2009-02-02 16:19:55 +00:00
parent 08b327c9bf
commit 1316f48499
2 changed files with 17 additions and 0 deletions
@@ -267,6 +267,17 @@ public abstract class BaseLiaison implements DatabaseLiaison
return true;
}
public boolean dropTable (Connection conn, String name)
throws SQLException
{
if (!tableExists(conn, name)) {
return false;
}
executeQuery(conn, "DROP TABLE " + tableSQL(name));
log.info("Table '" + name + "' dropped.");
return true;
}
/**
* Create an SQL string that summarizes a column definition in that format generally
* accepted in table creation and column addition statements, e.g.
@@ -190,6 +190,12 @@ public interface DatabaseLiaison
*/
public boolean tableExists (Connection conn, String name) throws SQLException;
/**
* Drops the given table and returns true if the table exists, else returns false.
* <em>Note:</em> the table name is case sensitive.
*/
public boolean dropTable (Connection conn, String name) throws SQLException;
/**
* Returns the proper SQL to identify a table. Some databases require table names to be quoted.
*/