1 5 package org.h2.engine; 6 7 import java.sql.SQLException ; 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 stringValue; 16 17 public Setting(Database database, int id, String 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 value) { 30 stringValue = value; 31 } 32 33 public String getStringValue() { 34 return stringValue; 35 } 36 37 public String getCreateSQLForCopy(Table table, String quotedName) { 38 throw Message.getInternalError(); 39 } 40 41 public String getCreateSQL() { 42 StringBuffer buff = new StringBuffer (); 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 { 63 throw Message.getUnsupportedException(); 64 } 65 66 } 67 | Popular Tags |