diff -r 7e08730da258 -r 4a1864c3e867 java/sql-dk/src/info/globalcode/sql/dk/SQLType.java --- a/java/sql-dk/src/info/globalcode/sql/dk/SQLType.java Mon Mar 04 17:06:42 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/** - * SQL-DK - * Copyright © 2013 František Kučera (frantovo.cz) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package info.globalcode.sql.dk; - -import java.sql.Types; - -/** - * Data types of SQL parameters. - * - * @author Ing. František Kučera (frantovo.cz) - */ -public enum SQLType { - - /** - * Names must be upper case – user input is also converted to upper case → case insensitive - */ - BIT(Types.BIT), - TINYINT(Types.TINYINT), - SMALLINT(Types.SMALLINT), - INTEGER(Types.INTEGER), - BIGINT(Types.BIGINT), - FLOAT(Types.FLOAT), - REAL(Types.REAL), - DOUBLE(Types.DOUBLE), - NUMERIC(Types.NUMERIC), - DECIMAL(Types.DECIMAL), - CHAR(Types.CHAR), - VARCHAR(Types.VARCHAR), - LONGVARCHAR(Types.LONGVARCHAR), - DATE(Types.DATE), - TIME(Types.TIME), - TIMESTAMP(Types.TIMESTAMP), - BINARY(Types.BINARY), - VARBINARY(Types.VARBINARY), - LONGVARBINARY(Types.LONGVARBINARY), - NULL(Types.NULL), - OTHER(Types.OTHER), - JAVA_OBJECT(Types.JAVA_OBJECT), - DISTINCT(Types.DISTINCT), - STRUCT(Types.STRUCT), - ARRAY(Types.ARRAY), - BLOB(Types.BLOB), - CLOB(Types.CLOB), - REF(Types.REF), - DATALINK(Types.DATALINK), - BOOLEAN(Types.BOOLEAN), - ROWID(Types.ROWID), - NCHAR(Types.NCHAR), - NVARCHAR(Types.NVARCHAR), - LONGNVARCHAR(Types.LONGNVARCHAR), - NCLOB(Types.NCLOB), - SQLXML(Types.SQLXML); - /** value from java.sql.Types */ - private int code; - - private SQLType(int code) { - this.code = code; - } - - /** - * @see java.sql.Types.Types - */ - public int getCode() { - return code; - } - - /** - * @param code see {@linkplain java.sql.Types.Types} - * @return found SQLType - * @throws IllegalArgumentException if no data type has given code - */ - public static SQLType valueOf(int code) { - for (SQLType t : values()) { - if (t.code == code) { - return t; - } - } - throw new IllegalArgumentException("No data type has code: " + code); - } -}