KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > h2 > engine > Setting


1 /*
2  * Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
3  * Initial Developer: H2 Group
4  */

5 package org.h2.engine;
6
7 import java.sql.SQLException JavaDoc;
8
9 import org.h2.message.Message;
10 import org.h2.message.Trace;
11 import org.h2.table.Table;
12
13 public class Setting extends DbObject {
14     private int intValue;
15     private String JavaDoc stringValue;
16
17     public Setting(Database database, int id, String JavaDoc settingName) {
18         super(database, id, settingName, Trace.SETTING);
19     }
20
21     public void setIntValue(int value) {
22         intValue = value;
23     }
24
25     public int getIntValue() {
26         return intValue;
27     }
28     
29     public void setStringValue(String JavaDoc value) {
30         stringValue = value;
31     }
32     
33     public String JavaDoc getStringValue() {
34         return stringValue;
35     }
36
37     public String JavaDoc getCreateSQLForCopy(Table table, String JavaDoc quotedName) {
38         throw Message.getInternalError();
39     }
40     
41     public String JavaDoc getCreateSQL() {
42         StringBuffer JavaDoc buff = new StringBuffer JavaDoc();
43         buff.append("SET ");
44         buff.append(getSQL());
45         buff.append(' ');
46         if(stringValue != null) {
47             buff.append(stringValue);
48         } else {
49             buff.append(intValue);
50         }
51         return buff.toString();
52     }
53
54     public int getType() {
55         return DbObject.SETTING;
56     }
57
58     public void removeChildrenAndResources(Session session) {
59         invalidate();
60     }
61
62     public void checkRename() throws SQLException JavaDoc {
63         throw Message.getUnsupportedException();
64     }
65
66 }
67
Popular Tags