Java SQL Type getJdbcType(int firebirdType)

Here you can find the source of getJdbcType(int firebirdType)

Description

get Jdbc Type

License

Open Source License

Declaration

public static int getJdbcType(int firebirdType) 

Method Source Code

//package com.java2s;
/*//  w w  w .  j  ava2s .c  om
 * Copyright (C) 2007 - 2009 members of the Firebird development team
 * and others.
 * This file was created by members of the Firebird development team.
 * All individual contributions remain the Copyright (C) of those
 * individuals. Contributors to this file are either listed here or
 * can be obtained from a source control (eg CVS) history command.
 * 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:
 *     Roman Rokytskyy  - Initial implementation
 *     Mark Rotteveel   - Code cleanup, further development
 */

import java.sql.Types;

public class Main {
    private static final short smallint_type = 7;
    private static final short integer_type = 8;
    private static final short quad_type = 9;
    private static final short float_type = 10;
    private static final short d_float_type = 11;
    private static final short date_type = 12;
    private static final short time_type = 13;
    private static final short char_type = 14;
    private static final short int64_type = 16;
    private static final short double_type = 27;
    private static final short timestamp_type = 35;
    private static final short varchar_type = 37;
    private static final short cstring_type = 40;
    private static final short blob_type = 261;

    public static int getJdbcType(int firebirdType) {
        switch (firebirdType) {

        case smallint_type:
            return Types.SMALLINT;

        case integer_type:
            return Types.INTEGER;

        case quad_type:
            return Types.ARRAY;

        case float_type:
            return Types.FLOAT;

        case d_float_type:
            return Types.DECIMAL;

        case date_type:
            return Types.DATE;

        case time_type:
            return Types.TIME;

        case char_type:
            return Types.CHAR;

        case int64_type:
            return Types.BIGINT;

        case double_type:
            return Types.DOUBLE;

        case timestamp_type:
            return Types.TIMESTAMP;

        case varchar_type:
            return Types.VARCHAR;

        case cstring_type:
            return Types.OTHER;

        case blob_type:
            return Types.BLOB;

        default:
            return Types.OTHER;
        }
    }
}

Related

  1. getJavaType(int jdbcType)
  2. getJavaType(int sqlType)
  3. getJavaType(String rdbType)
  4. getJavaTypeFromSqlType(int sqlType)
  5. getJavaTypeNameByJdbcType(int jdbcType)
  6. getJdbcType(String datatype)
  7. getJdbcType(String typeName)
  8. getJdbcTypeClass(int type)
  9. getJDBCTypeForNamedType(String aTypeName)