Java SQL Type convertToString(int datatype)

Here you can find the source of convertToString(int datatype)

Description

Converts the data type id to data type string

License

Open Source License

Parameter

Parameter Description
datatype a parameter

Declaration

public static String convertToString(int datatype) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2005, 2010 Sybase, Inc. and others
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:// www  .j  av  a  2 s  .c  o  m
 *    Sybase, Inc. - initial API and implementation
 *******************************************************************************/

import java.sql.Types;

public class Main {
    /**
     * Converts the data type id to data type string
     * 
     * @param datatype
     * @return
     */
    public static String convertToString(int datatype) {
        switch (datatype) {
        case Types.ARRAY:
            return "ARRAY";
        case Types.BIGINT:
            return "BIGINT";
        case Types.BINARY:
            return "BINARY";
        case Types.BIT:
            return "BIT";
        case Types.BLOB:
            return "BLOB";
        case Types.BOOLEAN:
            return "BOOLEAN";
        case Types.CHAR:
            return "CHAR";
        case Types.CLOB:
            return "CLOB";
        case Types.DATALINK:
            return "DATALINK";
        case Types.DATE:
            return "DATE";
        case Types.DECIMAL:
            return "DECIMAL";
        case Types.DISTINCT:
            return "DISTINCT";
        case Types.DOUBLE:
            return "DOUBLE";
        case Types.FLOAT:
            return "FLOAT";
        case Types.INTEGER:
            return "INTEGER";
        case Types.LONGVARBINARY:
            return "LONGVARBINARY";
        case Types.LONGVARCHAR:
            return "LONGVARCHAR";
        case Types.NULL:
            return "NULL";
        case Types.NUMERIC:
            return "NUMERIC";
        case Types.REAL:
            return "REAL";
        case Types.OTHER:
            return "OTHER";
        case Types.REF:
            return "REF";
        case Types.SMALLINT:
            return "SMALLINT";
        case Types.STRUCT:
            return "STRUCT";
        case Types.TIME:
            return "TIME";
        case Types.TIMESTAMP:
            return "TIMESTAMP";
        case Types.TINYINT:
            return "TINYINT";
        case Types.VARBINARY:
            return "VARBINARY";
        case Types.VARCHAR:
            return "VARCHAR";
        default:
            return "UNKNOWN";
        }
    }
}

Related

  1. convertStringToType(String type)
  2. convertTemporal(Object value, int srcType, int destType)
  3. convertToJDBCType(String talendType)
  4. convertToProperty(Object value)
  5. convertToStream(final Object o)
  6. convertType(final int type)
  7. convertType(final int type, final String typeName)
  8. createAllTypesTable(Connection conn)
  9. createArrTypSql(String[] arr)