📄 typecompilerfactoryimpl.java
字号:
/* Derby - Class org.apache.derby.impl.sql.compile.TypeCompilerFactoryImpl Copyright 1999, 2004 The Apache Software Foundation or its licensors, as applicable. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */package org.apache.derby.impl.sql.compile;import org.apache.derby.iapi.sql.compile.TypeCompilerFactory;import org.apache.derby.iapi.sql.compile.TypeCompiler;import org.apache.derby.iapi.types.TypeId;import org.apache.derby.iapi.services.sanity.SanityManager;import org.apache.derby.iapi.reference.JDBC20Translation;import org.apache.derby.iapi.reference.JDBC30Translation;import org.apache.derby.iapi.services.io.StoredFormatIds;import java.util.Properties;import java.sql.Types;public class TypeCompilerFactoryImpl implements TypeCompilerFactory{ private static final String PACKAGE_NAME = "org.apache.derby.impl.sql.compile."; // These are all the TypeCompilers that are stateless, so we can // use a single instance of each. Initialize all to null, and fault // them in. static TypeCompiler bitTypeCompiler; static TypeCompiler booleanTypeCompiler; static TypeCompiler charTypeCompiler; static TypeCompiler decimalTypeCompiler ; static TypeCompiler doubleTypeCompiler ; static TypeCompiler intTypeCompiler ; static TypeCompiler longintTypeCompiler ; static TypeCompiler longvarbitTypeCompiler ; static TypeCompiler longvarcharTypeCompiler ; static TypeCompiler nationalCharTypeCompiler ; static TypeCompiler nationalLongvarcharTypeCompiler ; static TypeCompiler nationalVarcharTypeCompiler ; static TypeCompiler realTypeCompiler ; static TypeCompiler smallintTypeCompiler ; static TypeCompiler tinyintTypeCompiler ; static TypeCompiler dateTypeCompiler ; static TypeCompiler timeTypeCompiler ; static TypeCompiler timestampTypeCompiler ; static TypeCompiler varbitTypeCompiler ; static TypeCompiler varcharTypeCompiler ; static TypeCompiler refTypeCompiler ; static TypeCompiler blobTypeCompiler ; static TypeCompiler clobTypeCompiler ; static TypeCompiler nclobTypeCompiler ; static TypeCompiler xmlTypeCompiler ; /** * Get a TypeCompiler corresponding to the given TypeId * * @param typeId The TypeId to get a TypeCompiler for * * @return The corresponding TypeCompiler */ public TypeCompiler getTypeCompiler(TypeId typeId) { return staticGetTypeCompiler(typeId); } static TypeCompiler staticGetTypeCompiler(TypeId typeId) { String sqlTypeName; switch (typeId.getJDBCTypeId()) { case Types.BINARY: return bitTypeCompiler = getAnInstance(PACKAGE_NAME + "BitTypeCompiler", bitTypeCompiler, typeId); case Types.BIT: case JDBC30Translation.SQL_TYPES_BOOLEAN: return booleanTypeCompiler = getAnInstance(PACKAGE_NAME + "BooleanTypeCompiler", booleanTypeCompiler, typeId); case Types.CHAR: sqlTypeName = typeId.getSQLTypeName(); if (sqlTypeName.equals(TypeId.CHAR_NAME)) { return charTypeCompiler = getAnInstance(PACKAGE_NAME + "CharTypeCompiler", charTypeCompiler, typeId); } else { return nationalCharTypeCompiler = getAnInstance(PACKAGE_NAME + "CharTypeCompiler", nationalCharTypeCompiler, typeId); } case Types.NUMERIC: case Types.DECIMAL: return decimalTypeCompiler = getAnInstance(PACKAGE_NAME + "NumericTypeCompiler", decimalTypeCompiler, typeId); case Types.DOUBLE: return doubleTypeCompiler = getAnInstance(PACKAGE_NAME + "NumericTypeCompiler", doubleTypeCompiler, typeId); case Types.INTEGER: return intTypeCompiler = getAnInstance(PACKAGE_NAME + "NumericTypeCompiler", intTypeCompiler, typeId); case Types.BIGINT: return longintTypeCompiler = getAnInstance(PACKAGE_NAME + "NumericTypeCompiler", longintTypeCompiler, typeId); case JDBC20Translation.SQL_TYPES_BLOB: return blobTypeCompiler = getAnInstance(PACKAGE_NAME + "LOBTypeCompiler", blobTypeCompiler, typeId); case Types.LONGVARBINARY: return longvarbitTypeCompiler = getAnInstance(PACKAGE_NAME + "BitTypeCompiler", longvarbitTypeCompiler, typeId); case JDBC20Translation.SQL_TYPES_CLOB: sqlTypeName = typeId.getSQLTypeName(); if (sqlTypeName.equals(TypeId.CLOB_NAME)) { return clobTypeCompiler = getAnInstance(PACKAGE_NAME + "CLOBTypeCompiler", clobTypeCompiler, typeId); } else { return nclobTypeCompiler =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -