1 /*
2
3 Loader - tool for transfering data from one JDBC source to another and
4 doing transformations during copy.
5
6 Copyright (C) 2002 Together
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 /*
23 * DropDatabaseOperation.java Aug 30, 2002
24 * Sinisa Milosevic sinisami@eunet.yu
25 *
26 */
27
28
29 package org.webdocwf.util.loader.test;
30
31 import java.sql.Connection;
32 import java.sql.Statement;
33 import org.webdocwf.util.loader.test.DatabaseOperation;
34 import org.webdocwf.util.loader.Loader;
35 import org.webdocwf.util.loader.LoaderException;
36
37 import java.sql.SQLException;
38
39 /***
40 * Deletes entire database using sql command (DROP DATABASE) or specified loader job.
41 *
42 * @author Sinisa Milosevic
43 * @version $Revision: 1.1 $
44 */
45 public class DropDatabaseOperation extends DatabaseOperation
46 {
47
48 private String databaseName=null;
49
50 DropDatabaseOperation()
51 {
52 }
53
54 public DropDatabaseOperation(String name)
55 {
56 databaseName=name;
57 }
58
59 ////////////////////////////////////////////////////////////////////////////
60 // DatabaseOperation class
61
62 /***
63 * Executes this operation on the specified database using the specified
64 * connection to the database.
65 *
66 * @param conn the database connection.
67 */
68
69 public void execute(Connection conn) throws SQLException
70 {
71 Statement stmt = conn.createStatement();
72
73 if(databaseName!=null){
74 try
75 {
76 stmt.execute("DROP DATABASE "+databaseName);
77 }
78 finally
79 {
80 stmt.close();
81 }
82 }
83
84 }
85
86
87 /***
88 * Returns type of database operation
89 *
90 */
91 public String getDatabaseOperationType()
92 {
93 return DatabaseOperation.DROP;
94 }
95
96
97 }
98
99
100
101
102
103
104
This page was automatically generated by Maven