Java SQL Type getCloverTypeFromJdbcType(int jdbcDataType)

Here you can find the source of getCloverTypeFromJdbcType(int jdbcDataType)

Description

get Clover Type From Jdbc Type

License

Open Source License

Declaration

public static String getCloverTypeFromJdbcType(int jdbcDataType) 

Method Source Code

//package com.java2s;
/*/*from ww  w .j  a  v a 2 s.c om*/
 * The Kuali Financial System, a comprehensive financial management system for higher education.
 * 
 * Copyright 2005-2014 The Kuali Foundation
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero 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 Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.sql.Types;

public class Main {
    public static String getCloverTypeFromJdbcType(int jdbcDataType) {
        switch (jdbcDataType) {
        case Types.DATE:
        case Types.TIME:
        case Types.TIMESTAMP:
            return "date";
        case Types.ARRAY:
        case Types.BINARY:
        case Types.DATALINK:
        case Types.BLOB:
        case Types.DISTINCT:
        case Types.JAVA_OBJECT:
        case Types.NULL:
        case Types.OTHER:
        case Types.REF:
        case Types.STRUCT:
        case Types.VARBINARY:
        case Types.LONGVARBINARY:
            System.out
                    .println("Outputting cbyte for Type: " + jdbcDataType);
            return "cbyte";
        case Types.BIT:
        case Types.BOOLEAN:
            return "boolean";
        case Types.DECIMAL:
        case Types.DOUBLE:
        case Types.FLOAT:
        case Types.NUMERIC:
        case Types.REAL:
            return "numeric";
        case Types.INTEGER:
        case Types.SMALLINT:
            return "integer";
        case Types.BIGINT:
            return "long";
        case Types.CHAR:
        case Types.VARCHAR:
        case Types.CLOB:
        case Types.LONGVARCHAR:
            return "string";
        }
        System.out.println("Outputting string for unknown Type: "
                + jdbcDataType);
        return "string";
    }
}

Related

  1. getCallableStatementValue(CallableStatement cstm, int index)
  2. getCastExpression(Class aClass)
  3. getCharStream(Object value, int columnType)
  4. getClass(int sqlType, int precision, int scale)
  5. getClassByJdbcType(int type, int decimalDigits)
  6. getColumeTypeDesc(Class clazz)
  7. getColumnClass(int sqlType)
  8. getColumnType(Connection conn, String table, String column)
  9. getColumnType(String type)