KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nilostep > xlsql > sql > hsqldb > xlHsqldbWriter


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 package com.nilostep.xlsql.sql.hsqldb;
12
13 import com.nilostep.xlsql.sql.xlSqlWriter;
14
15 import java.sql.*;
16 import java.text.*;
17 import java.util.*;
18
19 /**
20  * @author Jim Caprioli
21  */

22 public class xlHsqldbWriter extends xlSqlWriter {
23     /**
24      * TODO: javadoc
25      *
26      * @param s
27      *
28      * @return sql string for 'CREATE SCHEMA'
29      */

30     public String JavaDoc wCreateSchema(String JavaDoc s) {
31         return "--";
32     }
33
34     /**
35      * TODO: javadoc
36      *
37      * @param s
38      * @param t
39      *
40      * @return sql string for 'DROP TABLE'
41      */

42     public String JavaDoc wDropTable(String JavaDoc s,
43                              String JavaDoc t) {
44         String JavaDoc sql;
45         sql = "DROP TABLE " + getTableName(s, t) + " IF EXISTS;";
46
47         return sql;
48     }
49
50     protected String JavaDoc getTableName(String JavaDoc s,
51                                   String JavaDoc t) {
52         String JavaDoc tablename;
53
54         if (s.equalsIgnoreCase("sa")) {
55             tablename = "\"" + t + "\"";
56         } else {
57             tablename = "\"" + s + "." + t + "\"";
58         }
59
60         return tablename;
61     }
62 }
Popular Tags