1 5 package org.h2.schema; 6 7 import java.sql.SQLException ; 8 9 import org.h2.engine.DbObject; 10 import org.h2.engine.Session; 11 import org.h2.expression.ValueExpression; 12 import org.h2.message.Message; 13 import org.h2.message.Trace; 14 import org.h2.table.Table; 15 import org.h2.value.Value; 16 17 public class Constant extends SchemaObject { 18 19 private Value value; 20 private ValueExpression expression; 21 22 public Constant(Schema schema, int id, String name) { 23 super(schema, id, name, Trace.SCHEMA); 24 } 25 26 public String getCreateSQLForCopy(Table table, String quotedName) { 27 throw Message.getInternalError(); 28 } 29 30 public String getCreateSQL() { 31 StringBuffer buff = new StringBuffer (); 32 buff.append("CREATE CONSTANT "); 33 buff.append(getSQL()); 34 buff.append(" VALUE "); 35 buff.append(value.getSQL()); 36 return buff.toString(); 37 } 38 39 public int getType() { 40 return DbObject.CONSTANT; 41 } 42 43 public void removeChildrenAndResources(Session session) throws SQLException { 44 invalidate(); 45 } 46 47 public void checkRename() throws SQLException { 48 } 49 50 public void setValue(Value value) { 51 this.value = value; 52 expression = ValueExpression.get(value); 53 } 54 55 public ValueExpression getValue() { 56 return expression; 57 } 58 59 } 60 | Popular Tags |