1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import org.apache.derby.iapi.services.loader.ClassFactory; 25 import org.apache.derby.iapi.services.sanity.SanityManager; 26 import org.apache.derby.iapi.services.io.StoredFormatIds; 27 import org.apache.derby.iapi.sql.compile.TypeCompiler; 28 29 import org.apache.derby.iapi.error.StandardException; 30 31 import org.apache.derby.iapi.types.TypeId; 32 import org.apache.derby.iapi.types.DataTypeDescriptor; 33 34 import org.apache.derby.iapi.reference.ClassName; 35 36 39 40 public class XMLTypeCompiler extends BaseTypeCompiler 41 { 42 51 public boolean comparable(TypeId otherType, 52 boolean forEquals, 53 ClassFactory cs) 54 { 55 return false; 58 } 59 60 68 public boolean convertible(TypeId otherType, 69 boolean forDataTypeFunction) 70 { 71 return otherType.isXMLTypeId(); 76 } 77 78 83 public boolean compatible(TypeId otherType) 84 { 85 return otherType.isXMLTypeId(); 88 } 89 90 100 public boolean storable(TypeId otherType, ClassFactory cf) 101 { 102 return otherType.isXMLTypeId(); 109 } 110 111 114 public String interfaceName() { 115 return ClassName.XMLDataValue; 116 } 117 118 121 public String getCorrespondingPrimitiveTypeName() 122 { 123 int formatId = getStoredFormatIdFromTypeId(); 124 if (formatId == StoredFormatIds.XML_TYPE_ID) 125 return "org.apache.derby.iapi.types.XML"; 126 127 if (SanityManager.DEBUG) { 128 SanityManager.THROWASSERT( 129 "unexpected formatId in getCorrespondingPrimitiveTypeName(): " 130 + formatId); 131 } 132 133 return null; 134 } 135 136 143 public int getCastToCharWidth(DataTypeDescriptor dts) 144 { 145 return -1; 146 } 147 148 151 protected String nullMethodName() 152 { 153 int formatId = getStoredFormatIdFromTypeId(); 154 if (formatId == StoredFormatIds.XML_TYPE_ID) 155 return "getNullXML"; 156 157 if (SanityManager.DEBUG) { 158 SanityManager.THROWASSERT( 159 "unexpected formatId in nullMethodName(): " + formatId); 160 } 161 162 return null; 163 } 164 165 168 protected String dataValueMethodName() 169 { 170 int formatId = getStoredFormatIdFromTypeId(); 171 if (formatId == StoredFormatIds.XML_TYPE_ID) 172 return "getXMLDataValue"; 173 174 if (SanityManager.DEBUG) { 175 SanityManager.THROWASSERT( 176 "unexpected formatId in dataValueMethodName() - " + formatId); 177 } 178 179 return null; 180 } 181 } 182 | Popular Tags |