File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\engine\Setting.java.html

1 /*
2 * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,
3 * Version 1.0, and under the Eclipse Public License, Version 1.0
4 * (http://h2database.com/html/license.html).
5 * Initial Developer: H2 Group
6 */
7 package org.h2.engine;
8
9 import org.h2.message.DbException;
10 import org.h2.message.Trace;
11 import org.h2.table.Table;
12
13 /**
14 * A persistent database setting.
15 */
16 public class Setting extends DbObjectBase {
17
18 private int intValue;
19 private String stringValue;
20
21 public Setting(Database database, int id, String settingName) {
22 initDbObjectBase(database, id, settingName, Trace.SETTING);
23 }
24
25 public void setIntValue(int value) {
26 intValue = value;
27 }
28
29 public int getIntValue() {
30 return intValue;
31 }
32
33 public void setStringValue(String value) {
34 stringValue = value;
35 }
36
37 public String getStringValue() {
38 return stringValue;
39 }
40
41 public String getCreateSQLForCopy(Table table, String quotedName) {
42 throw DbException.throwInternalError();
43 }
44
45 public String getDropSQL() {
46 return null;
47 }
48
49 public String getCreateSQL() {
50 StringBuilder buff = new StringBuilder("SET ");
51 buff.append(getSQL()).append(' ');
52 if (stringValue != null) {
53 buff.append(stringValue);
54 } else {
55 buff.append(intValue);
56 }
57 return buff.toString();
58 }
59
60 public int getType() {
61 return DbObject.SETTING;
62 }
63
64 public void removeChildrenAndResources(Session session) {
65 database.removeMeta(session, getId());
66 invalidate();
67 }
68
69 public void checkRename() {
70 throw DbException.getUnsupportedException("RENAME");
71 }
72
73 }
74