📄 types.java
字号:
/* Copyright (c) 2001-2005, The HSQL Development Group
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of the HSQL Development Group nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG,
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.hsqldb;import org.hsqldb.lib.IntKeyHashMap;import org.hsqldb.lib.IntValueHashMap;/** * Defines the constants that are used to identify SQL types for HSQLDB JDBC * inteface type reporting. The actual type constant values are equivalent * to those defined in the latest java.sql.Types, where available, * or those defined by ansi/iso SQL 200n otherwise. A type sub-identifer * has been added to differentiate HSQLDB-specific type specializations. * * @author boucherb@users * @version 1.7.2 * @since 1.7.2 */public class Types { /** * Names of types. * Used for external, JDBC reporting * Used for library and user function arguments */ public static final String DecimalClassName = "java.math.BigDecimal"; public static final String DateClassName = "java.sql.Date"; public static final String TimeClassName = "java.sql.Time"; public static final String TimestampClassName = "java.sql.Timestamp"; /** * The constant in the Java programming language, sometimes referred to * as a type code, that identifies the generic SQL type * <code>ARRAY</code>. * * @since JDK 1.2 */ public static final int ARRAY = 2003; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>BIGINT</code>. */ public static final int BIGINT = -5; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>BINARY</code>. */ public static final int BINARY = -2; /** * The constant in the Java programming language, sometimes referred to * as a type code, that identifies the generic SQL type * <code>BLOB</code>. * * @since JDK 1.2 */ public static final int BLOB = 2004; /** * The constant in the Java programming language, somtimes referred to * as a type code, that identifies the generic SQL type * <code>BOOLEAN</code>. * * @since JDK 1.4 */ public static final int BOOLEAN = 16; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>CHAR</code>. */ public static final int CHAR = 1; /** * The constant in the Java programming language, sometimes referred to * as a type code, that identifies the generic SQL type * <code>CLOB</code> * * @since JDK 1.2 */ public static final int CLOB = 2005; /** * The constant in the Java programming language, somtimes referred to * as a type code, that identifies the generic SQL type <code>DATALINK</code>. * * @since JDK 1.4 */ public static final int DATALINK = 70; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>DATE</code>. */ public static final int DATE = 91; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>DECIMAL</code>. */ public static final int DECIMAL = 3; /** * The constant in the Java programming language, sometimes referred to * as a type code, that identifies the generic SQL type * <code>DISTINCT</code>. * * @since JDK 1.2 */ public static final int DISTINCT = 2001; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>DOUBLE</code>. */ public static final int DOUBLE = 8; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>FLOAT</code>. */ public static final int FLOAT = 6; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>INTEGER</code>. */ public static final int INTEGER = 4; /** * The constant in the Java programming language, sometimes referred to * as a type code, that identifies the generic SQL type * <code>JAVA_OBJECT</code>. * * @since JDK 1.2 */ public static final int JAVA_OBJECT = 2000; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>LONGVARBINARY</code>. */ public static final int LONGVARBINARY = -4; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>LONGVARCHAR</code>. */ public static final int LONGVARCHAR = -1; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>NULL</code>. */ public static final int NULL = 0; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>NUMERIC</code>. */ public static final int NUMERIC = 2; /** * The constant in the Java programming language that indicates * that the SQL type is database-specific and * gets mapped to a Java object that can be accessed via * the methods <code>getObject</code> and <code>setObject</code>. */ public static final int OTHER = 1111; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>REAL</code>. */ public static final int REAL = 7; /** * The constant in the Java programming language, sometimes referred to * as a type code, that identifies the generic SQL type * <code>REF</code>. * * @since JDK 1.2 */ public static final int REF = 2006; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>SMALLINT</code>. */ public static final int SMALLINT = 5; /** * The constant in the Java programming language, sometimes referred to * as a type code, that identifies the generic SQL type * <code>STRUCT</code>. * * @since JDK 1.2 */ public static final int STRUCT = 2002; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>TIME</code>. */ public static final int TIME = 92; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>TIMESTAMP</code>. */ public static final int TIMESTAMP = 93; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>TINYINT</code>. */ public static final int TINYINT = -6; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>VARBINARY</code>. */ public static final int VARBINARY = -3; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the generic SQL type * <code>VARCHAR</code>. */ public static final int VARCHAR = 12; /** * <P>The constant in the Java programming language, sometimes referred * to as a type code, that identifies the recent SQL 200n SQL type * <code>XML</code>. * * @since SQL 200n */ public static final int XML = 137; /** * The default HSQLODB type sub-identifier. This indicates that an * HSQLDB type with this sub-type, if supported, is the very closest * thing HSQLDB offerers to the JDBC/SQL200n type */ public static final int TYPE_SUB_DEFAULT = 1; /** * The IGNORECASE type sub-identifier. This indicates that an HSQLDB type * with this sub-type, if supported, is the closest thing HSQLDB offerers * to the JDBC/SQL200n type, except that case is ignored in comparisons */ public static final int TYPE_SUB_IGNORECASE = TYPE_SUB_DEFAULT << 2; /** * Every (type,type-sub) combination known in the HSQLDB context. * Not every combination need be supported as a table or procedure * column type -- such determinations are handled in DITypeInfo. */ static final int[][] ALL_TYPES = { { ARRAY, TYPE_SUB_DEFAULT }, { BIGINT, TYPE_SUB_DEFAULT }, { BINARY, TYPE_SUB_DEFAULT }, { BLOB, TYPE_SUB_DEFAULT }, { BOOLEAN, TYPE_SUB_DEFAULT }, { CHAR, TYPE_SUB_DEFAULT }, { CLOB, TYPE_SUB_DEFAULT }, { DATALINK, TYPE_SUB_DEFAULT }, { DATE, TYPE_SUB_DEFAULT }, { DECIMAL, TYPE_SUB_DEFAULT }, { DISTINCT, TYPE_SUB_DEFAULT }, { DOUBLE, TYPE_SUB_DEFAULT }, { FLOAT, TYPE_SUB_DEFAULT }, { INTEGER, TYPE_SUB_DEFAULT }, { JAVA_OBJECT, TYPE_SUB_DEFAULT }, { LONGVARBINARY, TYPE_SUB_DEFAULT }, { LONGVARCHAR, TYPE_SUB_DEFAULT }, { NULL, TYPE_SUB_DEFAULT }, { NUMERIC, TYPE_SUB_DEFAULT }, { OTHER, TYPE_SUB_DEFAULT }, { REAL, TYPE_SUB_DEFAULT }, { REF, TYPE_SUB_DEFAULT }, { SMALLINT, TYPE_SUB_DEFAULT }, { STRUCT, TYPE_SUB_DEFAULT }, { TIME, TYPE_SUB_DEFAULT }, { TIMESTAMP, TYPE_SUB_DEFAULT }, { TINYINT, TYPE_SUB_DEFAULT }, { VARBINARY, TYPE_SUB_DEFAULT }, { VARCHAR, TYPE_SUB_DEFAULT }, { VARCHAR, TYPE_SUB_IGNORECASE }, { XML, TYPE_SUB_DEFAULT } }; /* SQL specifies predefined data types named by the following <key word>s: CHARACTER, CHARACTER VARYING, CHARACTER LARGE OBJECT, BINARY LARGE OBJECT, NUMERIC, DECIMAL, SMALLINT, INTEGER, BIGINT, FLOAT, REAL, DOUBLE PRECISION, BOOLEAN, DATE, TIME, TIMESTAMP, and INTERVAL. SQL 200n adds DATALINK in Part 9: Management of External Data (SQL/MED) and adds XML in Part 14: XML-Related Specifications (SQL/XML) */ // CLI type list from Table 37 static final int SQL_CHARACTER = 1; static final int SQL_CHAR = 1; static final int SQL_NUMERIC = 2; static final int SQL_DECIMAL = 3; static final int SQL_DEC = 3; static final int SQL_INTEGER = 4; static final int SQL_INT = 4; static final int SQL_SMALLINT = 5; static final int SQL_FLOAT = 6; static final int SQL_REAL = 7; static final int SQL_DOUBLE = 8; static final int SQL_CHARACTER_VARYING = 12; static final int SQL_CHAR_VARYING = 12; static final int SQL_VARCHAR = 12; static final int SQL_BOOLEAN = 16; static final int SQL_USER_DEFINED_TYPE = 17; static final int SQL_ROW = 19; static final int SQL_REF = 20; static final int SQL_BIGINT = 25; static final int SQL_BINARY_LARGE_OBJECT = 30; static final int SQL_BLOB = 30; static final int SQL_CHARACTER_LARGE_OBJECT = 40; static final int SQL_CLOB = 40; static final int SQL_ARRAY = 50; // not predefined static final int SQL_MULTISET = 55; // static final int SQL_DATE = 91; static final int SQL_TIME = 92; static final int SQL_TIMESTAMP = 93; // static final int SQL_TIME_WITH_TIME_ZONE = 94; static final int SQL_TIMESTAMP_WITH_TIME_ZONE = 95; // static final int SQL_INTERVAL_YEAR = 101; // static final int SQL_INTERVAL_MONTH = 102; static final int SQL_INTERVAL_DAY = 103; static final int SQL_INTERVAL_HOUR = 104; static final int SQL_INTERVAL_MINUTE = 105; static final int SQL_INTERVAL_SECOND = 106; static final int SQL_INTERVAL_YEAR_TO_MONTH = 107; static final int SQL_INTERVAL_DAY_TO_HOUR = 108; static final int SQL_INTERVAL_DAY_TO_MINUTE = 109; static final int SQL_INTERVAL_DAY_TO_SECOND = 110; static final int SQL_INTERVAL_HOUR_TO_MINUTE = 111; static final int SQL_INTERVAL_HOUR_TO_SECOND = 112; static final int SQL_INTERVAL_MINUTE_TO_SECOND = 113; // These values are not in table 37 of the SQL CLI 200n FCD, but some // are found in tables 6-9 and some are found in Annex A1: // c Header File SQLCLI.H and/or addendums in other documents, // such as: // SQL 200n Part 9: Management of External Data (SQL/MED) : DATALINK // SQL 200n Part 14: XML-Related Specifications (SQL/XML) : XML static final int SQL_BIT_VARYING = 15; // is in SQL99 but removed from 200n static final int SQL_DATALINK = 70; static final int SQL_UDT = 17; static final int SQL_UDT_LOCATOR = 18; static final int SQL_BLOB_LOCATOR = 31; static final int SQL_CLOB_LOCATOR = 41; static final int SQL_ARRAY_LOCATOR = 51; static final int SQL_MULTISET_LOCATOR = 56; static final int SQL_ALL_TYPES = 0; static final int SQL_DATETIME = 9; // collective name static final int SQL_INTERVAL = 10; // collective name
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -