01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.engine;
07:
08: import java.sql.SQLException;
09:
10: import org.h2.message.Message;
11: import org.h2.message.Trace;
12: import org.h2.table.Table;
13:
14: /**
15: * A persistent database setting.
16: */
17: public class Setting extends DbObjectBase {
18:
19: private int intValue;
20: private String stringValue;
21:
22: public Setting(Database database, int id, String settingName) {
23: super (database, id, settingName, Trace.SETTING);
24: }
25:
26: public void setIntValue(int value) {
27: intValue = value;
28: }
29:
30: public int getIntValue() {
31: return intValue;
32: }
33:
34: public void setStringValue(String value) {
35: stringValue = value;
36: }
37:
38: public String getStringValue() {
39: return stringValue;
40: }
41:
42: public String getCreateSQLForCopy(Table table, String quotedName) {
43: throw Message.getInternalError();
44: }
45:
46: public String getDropSQL() {
47: return null;
48: }
49:
50: public String getCreateSQL() {
51: StringBuffer buff = new StringBuffer();
52: buff.append("SET ");
53: buff.append(getSQL());
54: buff.append(' ');
55: if (stringValue != null) {
56: buff.append(stringValue);
57: } else {
58: buff.append(intValue);
59: }
60: return buff.toString();
61: }
62:
63: public int getType() {
64: return DbObject.SETTING;
65: }
66:
67: public void removeChildrenAndResources(Session session)
68: throws SQLException {
69: database.removeMeta(session, getId());
70: invalidate();
71: }
72:
73: public void checkRename() throws SQLException {
74: throw Message.getUnsupportedException();
75: }
76:
77: }
|