KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nilostep > xlsql > sql > xlSqlDropTable


1 /*(Header: NiLOSTEP / xlSQL)
2
3     Copyright (C) 2004 NiLOSTEP Information Sciences, all
4     rights reserved.
5     
6     This program is licensed under the terms of the GNU
7     General Public License.You should have received a copy
8     of the GNU General Public License along with this
9     program;
10 */

11
12 package com.nilostep.xlsql.sql;
13
14 import com.nilostep.xlsql.database.xlDatabase;
15 import com.nilostep.xlsql.database.*;
16
17 import java.sql.*;
18
19 /**
20  * Native xlSql DROP TABLE <identifier> ;
21  *
22  * @author Jim Caprioli
23  */

24 public class xlSqlDropTable implements xlSqlCommand {
25     //~ Instance variables ·····················································
26

27     protected com.nilostep.xlsql.database.xlDatabase db;
28     protected String JavaDoc _schema;
29     protected String JavaDoc _table;
30
31     /**
32      * Creates a new instance of type xlSqlDropTable.
33      *
34      * @param database xlDatabaseI instance
35      * @param schema schema name
36      * @param table table name
37      */

38     public xlSqlDropTable(com.nilostep.xlsql.database.xlDatabase database, String JavaDoc schema, String JavaDoc table) {
39         if (database == null) {
40             throw new NullPointerException JavaDoc("xlSQL: database null");
41         } else {
42             db = database;
43         }
44
45         if (schema == null) {
46             throw new NullPointerException JavaDoc("xlSQL: schema null");
47         } else {
48             _schema = schema;
49         }
50
51         if (table == null) {
52             throw new NullPointerException JavaDoc("xlSQL: table null");
53         } else {
54             _table = table;
55         }
56     }
57
58     /**
59      * Changelog reader for verifications
60      *
61      * @return true if allowed
62      * @throws SQLException if an unexpected error occurs
63      */

64     public boolean execAllowed() throws SQLException {
65         boolean ret = true;
66         return ret;
67     }
68
69     /**
70      * Adds command to queue
71      * @throws SQLException if an unexpected error occurs
72      */

73     public void execute() throws SQLException {
74         db.removeTable(_schema, _table);
75     }
76 }
Popular Tags