import groovy.sql.Sql
sql = Sql.newInstance(
"jdbc:h2:tcp://localhost/~/test",
"sa",
"",
"org.h2.Driver")
query = """
select
table_schema,
table_name
from
information_schema.tables
where
table_type = 'TABLE LINK'
order by table_name
"""
// Linked Tableのみをdropする
sql.eachRow(query){
println("drop:${it.table_schema}.${it.table_name}")
sql.execute("drop table " + it.table_schema +
"." + it.table_name);
}
動作環境
groovy 1.7.4, JDK6 Update 21, H2 Database 1.2.143 (2010-09-18)
0 件のコメント:
コメントを投稿