Java SQL Type getSqlType(int type)

Here you can find the source of getSqlType(int type)

Description

Gets the sqlType attribute of the FBUtils class

License

Open Source License

Parameter

Parameter Description
type Description of the Parameter

Return

The sqlType value

Declaration

public static String getSqlType(int type) 

Method Source Code

//package com.java2s;
/*// w  w  w  .j  a  v  a  2  s. co  m
 *  Copyright 2008 The MITRE Corporation (http://www.mitre.org/). All Rights Reserved.
 *
 * 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.
 */

import java.sql.Types;

public class Main {
    /**
     *  Gets the sqlType attribute of the FBUtils class
     *
     *@param  type  Description of the Parameter
     *@return       The sqlType value
     */
    public static String getSqlType(int type) {
        switch (type) {
        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.JAVA_OBJECT:
            return "JAVA_OBJECT ";
        case Types.LONGVARBINARY:
            return "LONGVARBINARY";
        case Types.LONGVARCHAR:
            return "LONGVARCHAR";
        case Types.NULL:
            return "NULL";
        case Types.NUMERIC:
            return "NUMERIC";
        case Types.OTHER:
            return "OTHER";
        case Types.REAL:
            return "REAL ";
        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 "VARCHAR";
        }
    }
}

Related

  1. getSerialPrimaryKeyTypeString(Connection conn)
  2. getSimpleTypeString(String dbType)
  3. getSQLAttributeType(int sqlType)
  4. getSQLException(String message, String sqlState, Exception exception)
  5. getSQLParameterSubstring(String value, int type)
  6. getSqlType(Object param)
  7. getSqlType(String cubridType)
  8. getSQLType(String text)
  9. getSQLType(String type)