Java SQL Type jdbcTypeToKylinDataType(int sqlType)

Here you can find the source of jdbcTypeToKylinDataType(int sqlType)

Description

jdbc Type To Kylin Data Type

License

Apache License

Declaration

public static String jdbcTypeToKylinDataType(int sqlType) 

Method Source Code

//package com.java2s;
/*/*from www .  j av  a 2s.  c  om*/
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 {
    public static String jdbcTypeToKylinDataType(int sqlType) {
        String result = "any";

        switch (sqlType) {
        case Types.CHAR:
            result = "char";
            break;
        case Types.VARCHAR:
        case Types.NVARCHAR:
        case Types.LONGVARCHAR:
            result = "varchar";
            break;
        case Types.NUMERIC:
        case Types.DECIMAL:
            result = "decimal";
            break;
        case Types.BIT:
        case Types.BOOLEAN:
            result = "boolean";
            break;
        case Types.TINYINT:
            result = "tinyint";
            break;
        case Types.SMALLINT:
            result = "smallint";
            break;
        case Types.INTEGER:
            result = "integer";
            break;
        case Types.BIGINT:
            result = "bigint";
            break;
        case Types.REAL:
        case Types.FLOAT:
        case Types.DOUBLE:
            result = "double";
            break;
        case Types.BINARY:
        case Types.VARBINARY:
        case Types.LONGVARBINARY:
            result = "byte";
            break;
        case Types.DATE:
            result = "date";
            break;
        case Types.TIME:
            result = "time";
            break;
        case Types.TIMESTAMP:
            result = "timestamp";
            break;
        default:
            //do nothing
            break;
        }

        return result;
    }
}

Related

  1. isTableMissing(Connection con)
  2. isTextType(int columnType)
  3. isValidReaderOrStream(final Object o)
  4. isXMLType(int type)
  5. jdbcType2javaType(int jdbcType)
  6. listToJson(List list)
  7. loadAllTypesData(Connection conn)
  8. loadTestDataForEveryType(Connection conn)
  9. mapECLtype2SQLtype(String ecltype)

  10. HOME | Copyright © www.java2s.com 2016