Example usage for java.sql Types CLOB

List of usage examples for java.sql Types CLOB

Introduction

In this page you can find the example usage for java.sql Types CLOB.

Prototype

int CLOB

To view the source code for java.sql Types CLOB.

Click Source Link

Document

The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type CLOB.

Usage

From source file:Main.java

private static boolean isClobType(int type) {
    return Types.CLOB == type;
}

From source file:org.apache.hadoop.hive.ql.dataImport.HiveTypes.java

public static String toHiveType(int sqlType) {

    switch (sqlType) {
    case Types.INTEGER:
    case Types.SMALLINT:
        return "INT";
    case Types.VARCHAR:
    case Types.CHAR:
    case Types.LONGVARCHAR:
    case Types.NVARCHAR:
    case Types.NCHAR:
    case Types.LONGNVARCHAR:
    case Types.DATE:
    case Types.TIME:
    case Types.TIMESTAMP:
    case Types.CLOB:
    case Types.OTHER:
        return "STRING";
    case Types.NUMERIC:
    case Types.DECIMAL:
    case Types.FLOAT:
    case Types.DOUBLE:
    case Types.REAL:
        return "DOUBLE";
    case Types.BIT:
    case Types.BOOLEAN:
        return "BOOLEAN";
    case Types.TINYINT:
        return "TINYINT";
    case Types.BIGINT:
        return "BIGINT";
    default:/*from   w  w  w  .  j a v a2s.c om*/
        return null;
    }
}

From source file:org.talend.utils.sql.TalendTypeConvert.java

private static Map<String, Integer> getMap() {
    if (map == null) {
        map = new HashMap<String, Integer>();
        map.put(talendTypeName(Boolean.class), Types.BOOLEAN);
        map.put(talendTypeName(Byte.class), Types.DECIMAL);
        map.put(talendTypeName(Character.class), Types.CHAR);
        map.put(talendTypeName(Date.class), Types.DATE);
        map.put(talendTypeName(String.class), Types.CLOB);
        map.put(talendTypeName(Double.class), Types.DOUBLE);
        map.put(talendTypeName(Float.class), Types.FLOAT);
        map.put(talendTypeName(Integer.class), Types.INTEGER);
        map.put(talendTypeName(Long.class), Types.INTEGER);
        map.put(talendTypeName(Short.class), Types.SMALLINT);
    }//from   w w  w .  j  av a  2 s.  c  o  m
    return map;
}

From source file:com.mirth.connect.donkey.model.channel.MetaDataColumnType.java

public static MetaDataColumnType fromSqlType(int sqlType) {
    switch (sqlType) {
    case Types.VARCHAR:
    case Types.NVARCHAR:
    case Types.LONGVARCHAR:
    case Types.LONGNVARCHAR:
    case Types.CLOB:
    case Types.NCLOB:
        return STRING;

    case Types.BIGINT:
    case Types.INTEGER:
    case Types.SMALLINT:
    case Types.TINYINT:
    case Types.DECIMAL:
    case Types.DOUBLE:
    case Types.FLOAT:
    case Types.NUMERIC:
    case Types.REAL:
        return NUMBER;

    case Types.BOOLEAN:
    case Types.BIT:
    case Types.CHAR:
        return BOOLEAN;

    case Types.TIMESTAMP:
    case Types.TIME:
    case Types.DATE:
        return TIMESTAMP;
    }//from   w  w  w . ja va2  s. co  m

    return null;
}

From source file:org.apache.sqoop.hive.HiveTypes.java

/**
 * Given JDBC SQL types coming from another database, what is the best
 * mapping to a Hive-specific type?//from w  w w.j  a  v a 2  s  .co  m
 */
public static String toHiveType(int sqlType) {

    switch (sqlType) {
    case Types.INTEGER:
    case Types.SMALLINT:
        return "INT";
    case Types.VARCHAR:
    case Types.CHAR:
    case Types.LONGVARCHAR:
    case Types.NVARCHAR:
    case Types.NCHAR:
    case Types.LONGNVARCHAR:
    case Types.DATE:
    case Types.TIME:
    case Types.TIMESTAMP:
    case Types.CLOB:
        return "STRING";
    case Types.NUMERIC:
    case Types.DECIMAL:
    case Types.FLOAT:
    case Types.DOUBLE:
    case Types.REAL:
        return "DOUBLE";
    case Types.BIT:
    case Types.BOOLEAN:
        return "BOOLEAN";
    case Types.TINYINT:
        return "TINYINT";
    case Types.BIGINT:
        return "BIGINT";
    default:
        // TODO(aaron): Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT,
        // BLOB, ARRAY, STRUCT, REF, JAVA_OBJECT.
        return null;
    }
}

From source file:org.apache.sqoop.hive.HiveTypesORC.java

/**
 * Given JDBC SQL types coming from another database, what is the best
 * mapping to a Hive-specific type?//from  ww  w.j  ava 2 s  . co  m
 */
public static String toHiveType(int sqlType) {

    switch (sqlType) {
    case Types.INTEGER:
    case Types.SMALLINT:
        return "INT";
    case Types.VARCHAR:
    case Types.CHAR:
    case Types.LONGVARCHAR:
    case Types.NVARCHAR:
    case Types.NCHAR:
    case Types.LONGNVARCHAR:
    case Types.DATE:
    case Types.TIME:
    case Types.TIMESTAMP:
    case Types.CLOB:
        return "STRING";
    case Types.NUMERIC:
    case Types.FLOAT:
    case Types.DOUBLE:
    case Types.REAL:
        return "DOUBLE";
    case Types.BIT:
    case Types.BOOLEAN:
        return "BOOLEAN";
    case Types.TINYINT:
        return "TINYINT";
    case Types.BIGINT:
        return "BIGINT";
    case Types.DECIMAL:
        return "DECIMAL";
    default:
        // TODO(aaron): Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT,
        // BLOB, ARRAY, STRUCT, REF, JAVA_OBJECT.
        return null;
    }
}

From source file:Main.java

public static String getCloverTypeFromJdbcType(int jdbcDataType) {
    switch (jdbcDataType) {
    case Types.DATE:
    case Types.TIME:
    case Types.TIMESTAMP:
        return "date";
    case Types.ARRAY:
    case Types.BINARY:
    case Types.DATALINK:
    case Types.BLOB:
    case Types.DISTINCT:
    case Types.JAVA_OBJECT:
    case Types.NULL:
    case Types.OTHER:
    case Types.REF:
    case Types.STRUCT:
    case Types.VARBINARY:
    case Types.LONGVARBINARY:
        System.out.println("Outputting cbyte for Type: " + jdbcDataType);
        return "cbyte";
    case Types.BIT:
    case Types.BOOLEAN:
        return "boolean";
    case Types.DECIMAL:
    case Types.DOUBLE:
    case Types.FLOAT:
    case Types.NUMERIC:
    case Types.REAL:
        return "numeric";
    case Types.INTEGER:
    case Types.SMALLINT:
        return "integer";
    case Types.BIGINT:
        return "long";
    case Types.CHAR:
    case Types.VARCHAR:
    case Types.CLOB:
    case Types.LONGVARCHAR:
        return "string";
    }/*from  www.j  av a  2 s.c  om*/
    System.out.println("Outputting string for unknown Type: " + jdbcDataType);
    return "string";
}

From source file:org.lazulite.boot.autoconfigure.core.repository.hibernate.type.ObjectSerializeUserType.java

@Override
public int[] sqlTypes() {
    return new int[] { Types.CLOB };
}

From source file:org.pentaho.reporting.engine.classic.core.modules.misc.tablemodel.TypeMapper.java

private static Class mapSQLType(final int t) {
    switch (t) {//  w  w w .  ja v a  2 s  .  c  om
    case Types.ARRAY:
        return Object[].class;
    case Types.BIGINT:
        return Long.class;
    case Types.BINARY:
        return byteArrayClass;
    case Types.BIT:
        return Boolean.class;
    case Types.BLOB:
        return Blob.class;
    case Types.BOOLEAN: // Types.BOOLEAN was not part of JDK1.2.2
        return Boolean.class;
    case Types.CHAR:
        return String.class;
    case Types.CLOB:
        return Clob.class;
    case Types.DATALINK: // Types.DATALINK was not part of JDK 1.2.2
        return URL.class;
    case Types.DATE:
        return java.sql.Date.class;
    case Types.DECIMAL:
        return java.math.BigDecimal.class;
    case Types.DISTINCT:
        return Object.class;
    case Types.DOUBLE:
        return Double.class;
    case Types.FLOAT:
        return Double.class;
    case Types.INTEGER:
        return Integer.class;
    case Types.JAVA_OBJECT:
        return Object.class;
    case Types.LONGVARBINARY:
        return byteArrayClass;
    case Types.LONGVARCHAR:
        return String.class;
    case Types.NCLOB:
        return NClob.class;
    case Types.NULL:
        return Object.class;
    case Types.NUMERIC:
        return java.math.BigDecimal.class;
    case Types.NCHAR:
    case Types.NVARCHAR:
    case Types.LONGNVARCHAR:
        return String.class;
    case Types.OTHER:
        return Object.class;
    case Types.REAL:
        return Float.class;
    case Types.REF:
        return Ref.class;
    case Types.ROWID:
        return RowId.class;
    case Types.SMALLINT:
        return Short.class;
    case Types.STRUCT:
        return Struct.class;
    case Types.SQLXML:
        return SQLXML.class;
    case Types.TIME:
        return Time.class;
    case Types.TIMESTAMP:
        return Timestamp.class;
    case Types.TINYINT:
        return Byte.class;
    case Types.VARBINARY:
        return byteArrayClass;
    case Types.VARCHAR:
        return String.class;
    default:
        return Object.class;
    }
}

From source file:org.apache.ojb.broker.metadata.FieldTypeClasses.java

/**
 * Returns a {@link FieldType} instance for the given sql type
 * (see {@link java.sql.Types}) as specified in JDBC 3.0 specification
 * (see JDBC 3.0 specification <em>Appendix B, Data Type Conversion Tables</em>).
 *
 * @param jdbcType Specify the type to look for.
 * @return A new specific {@link FieldType} instance.
 */// ww  w.j  a v a  2s  .co m
static FieldType newFieldType(JdbcType jdbcType) {
    FieldType result = null;
    switch (jdbcType.getType()) {
    case Types.ARRAY:
        result = new ArrayFieldType();
        break;
    case Types.BIGINT:
        result = new LongFieldType();
        break;
    case Types.BINARY:
        result = new ByteArrayFieldType();
        break;
    case Types.BIT:
        result = new BooleanFieldType();
        break;
    case Types.BLOB:
        result = new BlobFieldType();
        break;
    case Types.CHAR:
        result = new StringFieldType();
        break;
    case Types.CLOB:
        result = new ClobFieldType();
        break;
    case Types.DATE:
        result = new DateFieldType();
        break;
    case Types.DECIMAL:
        result = new BigDecimalFieldType();
        break;
    // Not needed, user have to use the underlying sql datatype in OJB mapping files
    //            case Types.DISTINCT:
    //                result = new DistinctFieldType();
    //                break;
    case Types.DOUBLE:
        result = new DoubleFieldType();
        break;
    case Types.FLOAT:
        result = new FloatFieldType();
        break;
    case Types.INTEGER:
        result = new IntegerFieldType();
        break;
    case Types.JAVA_OBJECT:
        result = new JavaObjectFieldType();
        break;
    case Types.LONGVARBINARY:
        result = new ByteArrayFieldType();
        break;
    case Types.LONGVARCHAR:
        result = new StringFieldType();
        break;
    case Types.NUMERIC:
        result = new BigDecimalFieldType();
        break;
    case Types.REAL:
        result = new FloatFieldType();
        break;
    case Types.REF:
        result = new RefFieldType();
        break;
    case Types.SMALLINT:
        result = new ShortFieldType();
        break;
    case Types.STRUCT:
        result = new StructFieldType();
        break;
    case Types.TIME:
        result = new TimeFieldType();
        break;
    case Types.TIMESTAMP:
        result = new TimestampFieldType();
        break;
    case Types.TINYINT:
        result = new ByteFieldType();
        break;
    case Types.VARBINARY:
        result = new ByteArrayFieldType();
        break;
    case Types.VARCHAR:
        result = new StringFieldType();
        break;
    case Types.OTHER:
        result = new JavaObjectFieldType();
        break;
    //
    //            case Types.NULL:
    //                result = new NullFieldType();
    //                break;

    //#ifdef JDBC30
    case Types.BOOLEAN:
        result = new BooleanFieldType();
        break;
    case Types.DATALINK:
        result = new URLFieldType();
        break;
    //#endif
    default:
        throw new OJBRuntimeException("Unkown or not supported field type specified, specified jdbc type was '"
                + jdbcType + "', as string: " + JdbcTypesHelper.getSqlTypeAsString(jdbcType.getType()));
    }
    // make sure that the sql type was set
    result.setSqlType(jdbcType);
    return result;
}