Java SQL Type getDefaultScale(int sqlType)

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

Description

get Default Scale

License

Open Source License

Declaration

public static int getDefaultScale(int sqlType) 

Method Source Code

//package com.java2s;
/***********************************************************************************************************************
 * Copyright (c) 2009 Sybase, Inc. 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
 * /*from  w  w  w  .  j  a v a2  s  .  c o m*/
 * Contributors: Sybase, Inc. - initial API and implementation
 **********************************************************************************************************************/

import java.sql.Types;

public class Main {
    public static int getDefaultScale(int sqlType) {
        switch (sqlType) {
        case Types.TIME:
        case Types.TIMESTAMP:
            return 3;
        case Types.DECIMAL:
        case Types.DOUBLE:
        case Types.FLOAT:
        case Types.NUMERIC:
        case Types.REAL:
        case Types.OTHER:
        case Types.INTEGER:
        case Types.SMALLINT:
        case Types.TINYINT:
        case Types.VARCHAR:
        case Types.BIGINT:
        case Types.BINARY:
        case Types.BIT:
        case Types.BLOB:
        case Types.BOOLEAN:
        case Types.CHAR:
        case Types.DATE:
        case Types.REF:
        case Types.STRUCT:
        case Types.VARBINARY:
        case Types.CLOB:
        case Types.DATALINK:
        case Types.DISTINCT:
        case Types.JAVA_OBJECT:
        case Types.LONGVARBINARY:
        case Types.LONGVARCHAR:
        case Types.NULL:
        default:
            return 0;
        }
    }
}

Related

  1. getColumnType(Connection conn, String table, String column)
  2. getColumnType(String type)
  3. getConnection(String jdbcUrl, Properties properties)
  4. getDbDataType(Object o)
  5. getDefaultPrecision(int sqlType)
  6. getDefaultValue(Class type)
  7. getDoubleTypeString(Connection conn)
  8. getDoubleTypeString(Connection conn)
  9. getExpressionChoices(int type)