KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > sqls > hsqldb > HsqlDbSQLGeneratorImpl


1 /*
2  * Copyright 2003, 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15
16  */

17 package org.apache.ws.jaxme.sqls.hsqldb;
18
19 import org.apache.ws.jaxme.sqls.Table;
20 import org.apache.ws.jaxme.sqls.impl.SQLGeneratorImpl;
21
22
23 /** <p>Default implementation of an SQL generator for HsqlDb schemas.</p>
24  *
25  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
26  */

27 public class HsqlDbSQLGeneratorImpl extends SQLGeneratorImpl implements HsqlDbSQLGenerator {
28    protected boolean isPrimaryKeyUniqueIndex() {
29       return false;
30    }
31
32    protected boolean isPrimaryKeyPartOfCreateTable() {
33       return true;
34    }
35
36    protected boolean isUniqueIndexPartOfCreateTable() {
37       return true;
38    }
39
40    protected boolean isNonUniqueIndexPartOfCreateTable() {
41       return false;
42    }
43
44    protected boolean isForeignKeyPartOfCreateTable() {
45       return true;
46    }
47
48    protected String JavaDoc getCreateTableHeader(Table pTable) {
49       if (pTable instanceof HsqlDbTable) {
50          HsqlDbTable table = (HsqlDbTable) pTable;
51          if (table.isCached()) {
52             return "CREATE CACHED TABLE " + pTable.getQName();
53          }
54       }
55       return super.getCreateTableHeader(pTable);
56    }
57 }
58
Popular Tags