1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import org.apache.derby.iapi.sql.dictionary.DataDictionary; 25 26 import org.apache.derby.iapi.error.StandardException; 27 import org.apache.derby.iapi.reference.SQLState; 28 29 import org.apache.derby.iapi.types.DataTypeDescriptor; 30 import org.apache.derby.iapi.sql.Row; 31 32 import org.apache.derby.iapi.store.access.Qualifier; 33 34 import org.apache.derby.impl.sql.compile.ExpressionClassBuilder; 35 36 import org.apache.derby.iapi.services.compiler.MethodBuilder; 37 import org.apache.derby.iapi.services.sanity.SanityManager; 38 39 49 50 public class BaseColumnNode extends ValueNode 51 { 52 private String columnName; 53 54 58 private TableName tableName; 59 60 67 68 public void init( 69 Object columnName, 70 Object tableName, 71 Object dts) throws StandardException 72 { 73 this.columnName = (String ) columnName; 74 this.tableName = (TableName) tableName; 75 setType((DataTypeDescriptor) dts); 76 } 77 78 84 85 public String toString() 86 { 87 if (SanityManager.DEBUG) 88 { 89 return "columnName: " + columnName + "\n" + 90 ( ( tableName != null) ? 91 tableName.toString() : 92 "tableName: null\n") + 93 super.toString(); 94 } 95 else 96 { 97 return ""; 98 } 99 } 100 101 106 107 public String getColumnName() 108 { 109 return columnName; 110 } 111 112 121 122 public String getTableName() 123 { 124 return ( ( tableName != null) ? tableName.getTableName() : null ); 125 } 126 127 135 public String getSchemaName() throws StandardException 136 { 137 return ( ( tableName != null) ? tableName.getSchemaName() : null ); 138 } 139 140 149 150 public void generateExpression(ExpressionClassBuilder acb, 151 MethodBuilder mb) 152 throws StandardException 153 { 154 throw StandardException.newException(SQLState.LANG_UNABLE_TO_GENERATE, 155 this.nodeHeader()); 156 } 157 158 170 protected int getOrderableVariantType() 171 { 172 return Qualifier.SCAN_INVARIANT; 173 } 174 175 178 protected boolean isEquivalent(ValueNode o) 179 { 180 if (isSameNodeType(o)) 181 { 182 BaseColumnNode other = (BaseColumnNode)o; 183 return other.tableName.equals(other.tableName) 184 && other.columnName.equals(columnName); 185 } 186 return false; 187 } 188 } 189 | Popular Tags |