KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > compile > RefTypeCompiler


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.compile.RefTypeCompiler
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (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 {
49     /** @see TypeCompiler#getCorrespondingPrimitiveTypeName */
50     public String JavaDoc getCorrespondingPrimitiveTypeName()
51     {
52         if (SanityManager.DEBUG)
53             SanityManager.THROWASSERT("getCorrespondingPrimitiveTypeName not implemented for SQLRef");
54         return null;
55     }
56
57     /**
58      * @see TypeCompiler#getCastToCharWidth
59      */

60     public int getCastToCharWidth(DataTypeDescriptor dts)
61     {
62         if (SanityManager.DEBUG)
63             SanityManager.THROWASSERT( "getCastToCharWidth not implemented for SQLRef");
64         return 0;
65     }
66
67     /** @see TypeCompiler#convertible */
68     public boolean convertible(TypeId otherType,
69                                boolean forDataTypeFunction)
70     {
71         return false;
72     }
73
74     /**
75      * Tell whether this type is compatible with the given type.
76      *
77      * @see TypeCompiler#compatible */

78     public boolean compatible(TypeId otherType)
79     {
80         return convertible(otherType,false);
81     }
82
83
84     /** @see TypeCompiler#comparable */
85     public boolean comparable(TypeId otherType,
86                               boolean forEquals,
87                               ClassFactory cf)
88     {
89         return false;
90     }
91
92     /** @see TypeCompiler#storable */
93     public boolean storable(TypeId otherType, ClassFactory cf)
94     {
95         return otherType.isRefTypeId();
96     }
97
98     /** @see TypeCompiler#interfaceName */
99     public String JavaDoc interfaceName()
100     {
101         return ClassName.RefDataValue;
102     }
103
104     protected String JavaDoc nullMethodName()
105     {
106         return "getNullRef";
107     }
108 }
109
Popular Tags