01: /*
02:
03: Derby - Class org.apache.derby.impl.sql.compile.RefTypeCompiler
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21:
22: package org.apache.derby.impl.sql.compile;
23:
24: import org.apache.derby.iapi.services.loader.ClassFactory;
25:
26: import org.apache.derby.iapi.error.StandardException;
27:
28: import org.apache.derby.iapi.types.TypeId;
29: import org.apache.derby.iapi.types.DataTypeDescriptor;
30: import org.apache.derby.iapi.types.DataTypeDescriptor;
31: import org.apache.derby.iapi.types.DataValueFactory;
32:
33: import org.apache.derby.iapi.types.RefDataValue;
34:
35: import org.apache.derby.iapi.sql.compile.TypeCompiler;
36:
37: import org.apache.derby.iapi.services.sanity.SanityManager;
38:
39: import org.apache.derby.iapi.reference.ClassName;
40:
41: /**
42: * This class implements TypeCompiler for the SQL REF datatype.
43: *
44: * @author Jeff Lichtman
45: */
46:
47: public class RefTypeCompiler extends BaseTypeCompiler {
48: /** @see TypeCompiler#getCorrespondingPrimitiveTypeName */
49: public String getCorrespondingPrimitiveTypeName() {
50: if (SanityManager.DEBUG)
51: SanityManager
52: .THROWASSERT("getCorrespondingPrimitiveTypeName not implemented for SQLRef");
53: return null;
54: }
55:
56: /**
57: * @see TypeCompiler#getCastToCharWidth
58: */
59: public int getCastToCharWidth(DataTypeDescriptor dts) {
60: if (SanityManager.DEBUG)
61: SanityManager
62: .THROWASSERT("getCastToCharWidth not implemented for SQLRef");
63: return 0;
64: }
65:
66: /** @see TypeCompiler#convertible */
67: public boolean convertible(TypeId otherType,
68: boolean forDataTypeFunction) {
69: return false;
70: }
71:
72: /**
73: * Tell whether this type is compatible with the given type.
74: *
75: * @see TypeCompiler#compatible */
76: public boolean compatible(TypeId otherType) {
77: return convertible(otherType, false);
78: }
79:
80: /** @see TypeCompiler#comparable */
81: public boolean comparable(TypeId otherType, boolean forEquals,
82: ClassFactory cf) {
83: return false;
84: }
85:
86: /** @see TypeCompiler#storable */
87: public boolean storable(TypeId otherType, ClassFactory cf) {
88: return otherType.isRefTypeId();
89: }
90:
91: /** @see TypeCompiler#interfaceName */
92: public String interfaceName() {
93: return ClassName.RefDataValue;
94: }
95:
96: protected String nullMethodName() {
97: return "getNullRef";
98: }
99: }
|