Java Code Examples for java.sql.Types#BIGINT

The following examples show how to use java.sql.Types#BIGINT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Field.java    From r-course with MIT License 6 votes vote down vote up
private boolean determineNeedsQuoting() {
    boolean retVal = false;

    switch (this.sqlType) {
        case Types.BIGINT:
        case Types.BIT:
        case Types.DECIMAL:
        case Types.DOUBLE:
        case Types.FLOAT:
        case Types.INTEGER:
        case Types.NUMERIC:
        case Types.REAL:
        case Types.SMALLINT:
        case Types.TINYINT:
            retVal = false;
            break;
        default:
            retVal = true;
    }
    return retVal;

}
 
Example 2
Source File: PreparedStatementBuilder.java    From presto with Apache License 2.0 6 votes vote down vote up
private static int typeToSqlType(Type type)
{
    if (type.equals(BIGINT)) {
        return Types.BIGINT;
    }
    if (type.equals(DOUBLE)) {
        return Types.DOUBLE;
    }
    if (type.equals(BOOLEAN)) {
        return Types.BOOLEAN;
    }
    if (isVarcharType(type)) {
        return Types.VARCHAR;
    }
    if (type.equals(VARBINARY)) {
        return Types.VARBINARY;
    }
    throw new IllegalArgumentException("Unknown type: " + type);
}
 
Example 3
Source File: FabricArray.java    From fabric-jdbc-connector with Apache License 2.0 6 votes vote down vote up
@Override
public int getBaseType() throws SQLException {
    if(array.length == 0) {
        return Types.JAVA_OBJECT;
    } else {
        Object element = array[0];
        if(element instanceof String) {
            return Types.VARCHAR;
        } else if(element instanceof Integer) {
            return Types.INTEGER;
        } else if(element instanceof Long) {
            return Types.BIGINT;
        } else if(element instanceof Double) {
            return Types.DOUBLE;
        } else if(element instanceof Float) {
            return Types.FLOAT;
        } else if(element instanceof Boolean) {
            return Types.BOOLEAN;
        } else {
            return Types.JAVA_OBJECT;
        }
    }
}
 
Example 4
Source File: TestResultSetMetaData.java    From commons-beanutils with Apache License 2.0 5 votes vote down vote up
public Integer getColumnType(final int columnIndex) throws SQLException {
        final String columnName = getColumnName(columnIndex);
        int sqlType = Types.OTHER;
        if (columnName.equals("bigDecimalProperty")) {
            sqlType = Types.DECIMAL;
// Types.BOOLEAN only introduced in JDK 1.4
//        } else if (columnName.equals("booleanProperty")) {
//            sqlType = Types.BOOLEAN;
        } else if (columnName.equals("byteProperty")) {
            sqlType = Types.TINYINT;
        } else if (columnName.equals("dateProperty")) {
            sqlType = Types.DATE;
        } else if (columnName.equals("doubleProperty")) {
            sqlType = Types.DOUBLE;
        } else if (columnName.equals("floatProperty")) {
            sqlType = Types.FLOAT;
        } else if (columnName.equals("intProperty")) {
            sqlType = Types.INTEGER;
        } else if (columnName.equals("longProperty")) {
            sqlType = Types.BIGINT;
        } else if (columnName.equals("nullProperty")) {
            sqlType = Types.VARCHAR;
        } else if (columnName.equals("shortProperty")) {
            sqlType = Types.SMALLINT;
        } else if (columnName.equals("stringProperty")) {
            sqlType = Types.VARCHAR;
        } else if (columnName.equals("timeProperty")) {
            sqlType = Types.TIME;
        } else if (columnName.equals("timestampProperty")) {
            sqlType = Types.TIMESTAMP;
        } else {
            sqlType = Types.OTHER;
        }
        return new Integer(sqlType);
    }
 
Example 5
Source File: KylinTestBase.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Override
public DataType createDataType(int sqlType, String sqlTypeName, String tableName, String columnName)
        throws DataTypeException {

    if ((columnName.startsWith("COL") || columnName.startsWith("col")) && sqlType == Types.BIGINT) {
        return DataType.INTEGER;
    }
    return super.createDataType(sqlType, sqlTypeName);
}
 
Example 6
Source File: JDBCAdapter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Class<?> getColumnClass(int column) {
    int type;
    try {
        type = metaData.getColumnType(column + 1);
    } catch (SQLException e) {
        return super.getColumnClass(column);
    }

    switch (type) {
        case Types.CHAR:
        case Types.VARCHAR:
        case Types.LONGVARCHAR:
            return String.class;

        case Types.BIT:
            return Boolean.class;

        case Types.TINYINT:
        case Types.SMALLINT:
        case Types.INTEGER:
            return Integer.class;

        case Types.BIGINT:
            return Long.class;

        case Types.FLOAT:
        case Types.DOUBLE:
            return Double.class;

        case Types.DATE:
            return java.sql.Date.class;

        default:
            return Object.class;
    }
}
 
Example 7
Source File: DataTypes.java    From gsn with GNU General Public License v3.0 5 votes vote down vote up
/**
  * throws runtime exception if the type conversion fails.
  * @param sqlType
  * @return
  */
 public static byte SQLTypeToGSNTypeSimplified(int sqlType) {
  if (sqlType == Types.BIGINT || sqlType == Types.SMALLINT || sqlType == Types.DOUBLE || sqlType==Types.INTEGER || sqlType == Types.DECIMAL||sqlType == Types.REAL || sqlType == Types.FLOAT|| sqlType == Types.NUMERIC )
	return  DataTypes.DOUBLE;
else if (sqlType == Types.VARCHAR || sqlType == Types.CHAR|| sqlType == Types.LONGNVARCHAR || sqlType == Types.LONGVARCHAR || sqlType== Types.NCHAR )
	return  DataTypes.VARCHAR;
else if (sqlType == Types.BINARY || sqlType == Types.BLOB|| sqlType == Types.VARBINARY )
	return  DataTypes.BINARY;
  throw new RuntimeException("Can't convert SQL type id of: "+sqlType+ " to GSN type id.");
 }
 
Example 8
Source File: Cursor.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
public final BigDecimal getBigDecimal(int column) throws SQLException {
  if (isNull(column))
    return null;
    switch (jdbcTypes_[column - 1]) {
    case Types.BOOLEAN:
        return BigDecimal.valueOf(getLong(column));
    case Types.DECIMAL:
        return get_DECIMAL(column);
    case Types.REAL:
        // Can't use the following commented out line because it changes precision of the result.
        //return new java.math.BigDecimal (get_FLOAT (column));
        float f = get_FLOAT(column);
        return new BigDecimal(String.valueOf(f));
    case Types.DOUBLE:
        return BigDecimal.valueOf(get_DOUBLE(column));
    case Types.SMALLINT:
        return BigDecimal.valueOf(get_SMALLINT(column));
    case Types.INTEGER:
        return BigDecimal.valueOf(get_INTEGER(column));
    case Types.BIGINT:
        return BigDecimal.valueOf(get_BIGINT(column));
    case Types.CHAR:
        return CrossConverters.getBigDecimalFromString(get_CHAR(column));
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
        return CrossConverters.getBigDecimalFromString(get_VARCHAR(column));
    default:
        throw coercionError( "java.math.BigDecimal", column );
    }
}
 
Example 9
Source File: PostgresStorageManager.java    From gsn with GNU General Public License v3.0 5 votes vote down vote up
@Override
public byte convertLocalTypeToGSN(int jdbcType, int precision) {
    switch (jdbcType) {
        case Types.BIGINT:
            return DataTypes.BIGINT;
        case Types.INTEGER:
            return DataTypes.INTEGER;
        case Types.SMALLINT:
            return DataTypes.SMALLINT;
        case Types.TINYINT:
            return DataTypes.TINYINT;
        case Types.VARCHAR:
            return DataTypes.VARCHAR;
        case Types.CHAR:
            return DataTypes.CHAR;
        case Types.DOUBLE:
        case Types.DECIMAL:    // This is needed for doing aggregates in datadownload servlet.
            return DataTypes.DOUBLE;
        case Types.REAL:   //should also be float mapped here ?
        	return DataTypes.FLOAT;
        case Types.BINARY:
        case Types.BLOB:
        case Types.VARBINARY:
        case Types.LONGVARBINARY:
            return DataTypes.BINARY;
        default:
            logger.error("The type can't be converted to GSN form : " + jdbcType);
            break;
    }
    return -100;
}
 
Example 10
Source File: InventoryDataTaskSplitter.java    From shardingsphere with Apache License 2.0 4 votes vote down vote up
private boolean isNotIntegerPrimary(final int columnType) {
    return Types.INTEGER != columnType && Types.BIGINT != columnType && Types.SMALLINT != columnType && Types.TINYINT != columnType;
}
 
Example 11
Source File: ExportAbstract.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
protected void doAllTheWork() throws Exception {

	ResultSet rs = null;
	try {
    	rs = resultSetForEntity();
    	if (rs != null) {
			ResultSetMetaData rsmeta = rs.getMetaData();
			int ncols = rsmeta.getColumnCount();
			boolean[] isNumeric = new boolean[ncols];
			boolean[] isLargeChar = new boolean[ncols];
			boolean[] isLargeBinary = new boolean[ncols];
			for (int i = 0; i < ncols; i++) {
				int ctype = rsmeta.getColumnType(i+1);
				if (ctype == Types.BIGINT || ctype == Types.DECIMAL || ctype == Types.DOUBLE ||
						ctype == Types.FLOAT ||ctype == Types.INTEGER || ctype == Types.NUMERIC ||
						ctype == Types.REAL ||ctype == Types.SMALLINT || ctype == Types.TINYINT)
    				isNumeric[i] = true;
				else 
					isNumeric[i] = false;
					
				if (ctype == Types.CLOB || ctype == JDBC40Translation.JSON)
					isLargeChar[i] = true;
				else 
					isLargeChar[i]= false;
				
				if (ctype == Types.BLOB) 
					isLargeBinary[i] = true;
				else 
					isLargeBinary[i] = false;
			}


			exportWriteData = getExportWriteData();
			exportWriteData.writeColumnDefinitionOptionally(
						exportResultSetForObject.getColumnDefinition(),
						exportResultSetForObject.getColumnTypes());
			exportWriteData.setColumnLengths(controlFileReader.getColumnWidths());

       		// get one row at a time and write it to the output file
            String[] oneRow = getOneRowAtATime(rs, 
                                               isLargeBinary, 
                                               isLargeChar);
       		while (oneRow != null) {
         		exportWriteData.writeData(oneRow, isNumeric);
                oneRow = getOneRowAtATime(rs, isLargeBinary, isLargeChar);
       		}
		}
	} finally {
		//cleanup work after no more rows
		if (exportWriteData != null)
			exportWriteData.noMoreRows();
		if (rs != null)
			rs.close();
    }
  }
 
Example 12
Source File: GfxdCBArgForSynchPrms.java    From gemfirexd-oss with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public int getPrecision(int column) throws SQLException {
  if (column > 0 && column <= this.numParams) {
    if (this.dtds != null) {
      return DataTypeUtilities.getPrecision(this.dtds[column - 1]);
    }
    else {
      switch (this.sqlParamTypes[column - 1]) {
        case Types.NUMERIC:
        case Types.DECIMAL:
          return JDBC30Translation.UNKNOWN_PRECISION;
        case Types.SMALLINT:
          return 5;
        case Types.INTEGER:
          return 10;
        case Types.BIGINT:
          return 19;
        case Types.FLOAT:
          return 15;
        case Types.REAL:
          // This is the number of signed digits for IEEE float with mantissa
          // 24, ie. 2^24
          return 7;
        case Types.DOUBLE:
          // This is the number of signed digits for IEEE float with mantissa
          // 24, ie. 2^24
          return 15;
        case Types.CHAR:
        case Types.VARCHAR:
        case Types.LONGVARCHAR:
        case Types.BINARY:
        case Types.VARBINARY:
        case Types.LONGVARBINARY:
        case CLOB:
        case BLOB:
        case JSON:
          return JDBC30Translation.UNKNOWN_PRECISION;
        case Types.DATE:
          return 10;
        case Types.TIME:
          return 8;
        case Types.TIMESTAMP:
          return 26;
        case JAVA_OBJECT:
          return JDBC30Translation.UNKNOWN_PRECISION;
        default:
          throw Util.generateCsSQLException(SQLState.UNSUPPORTED_TYPE);
      }
    }
  }
  else {
    throw Util.generateCsSQLException(SQLState.COLUMN_NOT_FOUND,
        Integer.valueOf(column));
  }
}
 
Example 13
Source File: TeradataDialect.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public String getSelectClauseNullString(int sqlType) {
	String v = "null";

	switch ( sqlType ) {
		case Types.BIT:
		case Types.TINYINT:
		case Types.SMALLINT:
		case Types.INTEGER:
		case Types.BIGINT:
		case Types.FLOAT:
		case Types.REAL:
		case Types.DOUBLE:
		case Types.NUMERIC:
		case Types.DECIMAL:
			v = "cast(null as decimal)";
			break;
		case Types.CHAR:
		case Types.VARCHAR:
		case Types.LONGVARCHAR:
			v = "cast(null as varchar(255))";
			break;
		case Types.DATE:
		case Types.TIME:
		case Types.TIMESTAMP:
			v = "cast(null as timestamp)";
			break;
		case Types.BINARY:
		case Types.VARBINARY:
		case Types.LONGVARBINARY:
		case Types.NULL:
		case Types.OTHER:
		case Types.JAVA_OBJECT:
		case Types.DISTINCT:
		case Types.STRUCT:
		case Types.ARRAY:
		case Types.BLOB:
		case Types.CLOB:
		case Types.REF:
		case Types.DATALINK:
		case Types.BOOLEAN:
			break;
	}
	return v;
}
 
Example 14
Source File: KylinClient.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes")
public static Class convertType(int sqlType) {
    Class result = Object.class;

    switch (sqlType) {
    case Types.CHAR:
    case Types.VARCHAR:
    case Types.LONGVARCHAR:
        result = String.class;
        break;
    case Types.NUMERIC:
    case Types.DECIMAL:
        result = BigDecimal.class;
        break;
    case Types.BIT:
    case Types.BOOLEAN:
        result = Boolean.class;
        break;
    case Types.TINYINT:
        result = Byte.class;
        break;
    case Types.SMALLINT:
        result = Short.class;
        break;
    case Types.INTEGER:
        result = Integer.class;
        break;
    case Types.BIGINT:
        result = Long.class;
        break;
    case Types.REAL:
    case Types.FLOAT:
    case Types.DOUBLE:
        result = Double.class;
        break;
    case Types.BINARY:
    case Types.VARBINARY:
    case Types.LONGVARBINARY:
        result = Byte[].class;
        break;
    case Types.DATE:
        result = Date.class;
        break;
    case Types.TIME:
        result = Time.class;
        break;
    case Types.TIMESTAMP:
        result = Timestamp.class;
        break;
    default:
        //do nothing
        break;
    }

    return result;
}
 
Example 15
Source File: ConnManager.java    From aliyun-maxcompute-data-collectors with Apache License 2.0 4 votes vote down vote up
/**
 * Resolve a database-specific type to Avro data type.
 * @param sqlType     sql type
 * @return            avro type
 */
public Type toAvroType(int sqlType) {
  switch (sqlType) {
  case Types.TINYINT:
  case Types.SMALLINT:
  case Types.INTEGER:
    return Type.INT;
  case Types.BIGINT:
    return Type.LONG;
  case Types.BIT:
  case Types.BOOLEAN:
    return Type.BOOLEAN;
  case Types.REAL:
    return Type.FLOAT;
  case Types.FLOAT:
  case Types.DOUBLE:
    return Type.DOUBLE;
  case Types.NUMERIC:
  case Types.DECIMAL:
    return Type.STRING;
  case Types.CHAR:
  case Types.VARCHAR:
  case Types.LONGVARCHAR:
  case Types.LONGNVARCHAR:
  case Types.NVARCHAR:
  case Types.NCHAR:
    return Type.STRING;
  case Types.DATE:
  case Types.TIME:
  case Types.TIMESTAMP:
    return Type.LONG;
  case Types.BLOB:
  case Types.BINARY:
  case Types.VARBINARY:
  case Types.LONGVARBINARY:
    return Type.BYTES;
  default:
    throw new IllegalArgumentException("Cannot convert SQL type "
        + sqlType);
  }
}
 
Example 16
Source File: DB2LengthOperatorNode.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
private int getConstantLength( ) throws StandardException
  {
      DataTypeDescriptor typeDescriptor = operand.getTypeServices();
      
      switch( typeDescriptor.getJDBCTypeId())
      {
      case Types.BIGINT:
          return 8;
case Types.BOOLEAN:
      case Types.BIT:
          return 1;
      case Types.BINARY:
      case Types.CHAR:
          return typeDescriptor.getMaximumWidth();
      case Types.DATE:
          return 4;
      case Types.DECIMAL:
      case Types.NUMERIC:
          return typeDescriptor.getPrecision()/2 + 1;
      case Types.DOUBLE:
          return 8;
      case Types.FLOAT:
      case Types.REAL:
      case Types.INTEGER:
          return 4;
      case Types.SMALLINT:
          return 2;
      case Types.TIME:
          return 3;
      case Types.TIMESTAMP:
          return 10;
      case Types.TINYINT:
          return 1;
      case Types.LONGVARCHAR:
      case Types.VARCHAR:
      case Types.LONGVARBINARY:
      case Types.VARBINARY:
      case Types.BLOB:
          return getConstantNodeLength();
      default:
	return -1;
      }
  }
 
Example 17
Source File: Util.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
public static String typeName(int jdbcType) {
	switch (jdbcType) {
		case Types.ARRAY: return TypeId.ARRAY_NAME;
		case Types.BIT 		:  return TypeId.BIT_NAME;
		case Types.BOOLEAN  : return TypeId.BOOLEAN_NAME;
		case Types.DATALINK: return TypeId.DATALINK_NAME;
		case Types.TINYINT 	:  return TypeId.TINYINT_NAME;
		case Types.SMALLINT	:  return TypeId.SMALLINT_NAME;
		case Types.INTEGER 	:  return TypeId.INTEGER_NAME;
		case Types.BIGINT 	:  return TypeId.LONGINT_NAME;

		case Types.FLOAT 	:  return TypeId.FLOAT_NAME;
		case Types.REAL 	:  return TypeId.REAL_NAME;
		case Types.DOUBLE 	:  return TypeId.DOUBLE_NAME;

		case Types.NUMERIC 	:  return TypeId.NUMERIC_NAME;
		case Types.DECIMAL	:  return TypeId.DECIMAL_NAME;

		case Types.CHAR		:  return TypeId.CHAR_NAME;
		case Types.VARCHAR 	:  return TypeId.VARCHAR_NAME;
		case Types.LONGVARCHAR 	:  return "LONGVARCHAR";
           case Types.CLOB     :  return TypeId.CLOB_NAME;

		case Types.DATE 		:  return TypeId.DATE_NAME;
		case Types.TIME 		:  return TypeId.TIME_NAME;
		case Types.TIMESTAMP 	:  return TypeId.TIMESTAMP_NAME;

		case Types.BINARY			:  return TypeId.BINARY_NAME;
		case Types.VARBINARY	 	:  return TypeId.VARBINARY_NAME;
		case Types.LONGVARBINARY 	:  return TypeId.LONGVARBINARY_NAME;
           case Types.BLOB             :  return TypeId.BLOB_NAME;

		case Types.OTHER		:  return "OTHER";
		case Types.JAVA_OBJECT	:  return "Types.JAVA_OBJECT";
		case Types.REF : return TypeId.REF_NAME;
		case JDBC40Translation.ROWID: return TypeId.ROWID_NAME;
		case Types.STRUCT: return TypeId.STRUCT_NAME;
		case StoredFormatIds.XML_TYPE_ID :  return TypeId.XML_NAME;
		case JDBC40Translation.SQLXML: return TypeId.SQLXML_NAME;
		default : return String.valueOf(jdbcType);
	}
}
 
Example 18
Source File: JavaSqlConversion.java    From aceql-http with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static String fromJavaToSql(int javaType) {
String sqlType = null;

if (javaType == Types.CHAR) {
    sqlType = AceQLTypes.CHAR;
} else if (javaType == Types.VARCHAR) {
    sqlType = AceQLTypes.VARCHAR;
} else if (javaType == Types.LONGVARCHAR) {
    sqlType = AceQLTypes.LONGVARCHAR;
} else if (javaType == Types.NUMERIC) {
    sqlType = AceQLTypes.NUMERIC;
} else if (javaType == Types.BIT) {
    sqlType = AceQLTypes.BIT;
} else if (javaType == Types.NUMERIC) {
    sqlType = AceQLTypes.NUMERIC;
} else if (javaType == Types.DECIMAL) {
    sqlType = AceQLTypes.DECIMAL;
} else if (javaType == Types.TINYINT) {
    sqlType = AceQLTypes.TINYINT;
} else if (javaType == Types.SMALLINT) {
    sqlType = AceQLTypes.SMALLINT;
} else if (javaType == Types.INTEGER) {
    sqlType = AceQLTypes.INTEGER;
} else if (javaType == Types.BIGINT) {
    sqlType = AceQLTypes.BIGINT;
} else if (javaType == Types.REAL) {
    sqlType = AceQLTypes.REAL;
} else if (javaType == Types.FLOAT) {
    sqlType = AceQLTypes.FLOAT;
} else if (javaType == Types.DOUBLE) {
    sqlType = AceQLTypes.DOUBLE_PRECISION;
} else if (javaType == Types.DATE) {
    sqlType = AceQLTypes.DATE;
} else if (javaType == Types.TIME) {
    sqlType = AceQLTypes.TIME;
} else if (javaType == Types.TIMESTAMP) {
    sqlType = AceQLTypes.TIMESTAMP;
} else if (javaType == Types.BINARY) {
    sqlType = AceQLTypes.BINARY;
} else if (javaType == Types.VARBINARY) {
    sqlType = AceQLTypes.VARBINARY;
} else if (javaType == Types.LONGVARBINARY) {
    sqlType = AceQLTypes.LONGVARBINARY;
} else if (javaType == Types.BLOB) {
    sqlType = AceQLTypes.BLOB;
} else if (javaType == Types.CLOB) {
    sqlType = AceQLTypes.CLOB;
} else {
    return "UNKNOWN";
}
return sqlType;
   }
 
Example 19
Source File: SQLTypeMap.java    From jeddict with Apache License 2.0 4 votes vote down vote up
/**
     * Translates a data type from an integer (java.sql.Types value) to a string
     * that represents the corresponding class.
     *
     * @param type The java.sql.Types value to convert to its corresponding
     * class.
     * @return The class that corresponds to the given java.sql.Types value, or
     * Object.class if the type has no known mapping.
     */
    public static Class<?> toClass(int type) {
        Class<?> result = Object.class;
// Pending type // NULL, OTHER, JAVA_OBJECT, DISTINCT, REF, DATALINK, STRUCT, ARRAY, BLOB, CLOB, LONGNVARCHAR, NCHAR, NCLOB, NVARCHAR, SQLXML, ROWID
        switch (type) {
            case Types.CHAR:
            case Types.VARCHAR:
            case Types.LONGVARCHAR:
                result = String.class;
                break;

            case Types.NUMERIC:
            case Types.DECIMAL:
                result = java.math.BigDecimal.class;
                break;

            case Types.BOOLEAN:
            case Types.BIT:
                result = Boolean.class;
                break;

            case Types.TINYINT:
                result = Byte.class;
                break;

            case Types.SMALLINT:
                result = Short.class;
                break;

            case Types.INTEGER:
                result = Integer.class;
                break;

            case Types.BIGINT:
                result = Long.class;
                break;

            case Types.REAL:
            case Types.FLOAT:
                result = Float.class;
                break;

            case Types.DOUBLE:
                result = Double.class;
                break;

            case Types.BINARY:
            case Types.VARBINARY:
            case Types.LONGVARBINARY:
                result = Byte[].class;
                break;

            case Types.DATE:
                result = java.sql.Date.class;
                break;

            case Types.TIME:
                result = java.sql.Time.class;
                break;

            case Types.TIMESTAMP:
                result = java.sql.Timestamp.class;
                break;
        }

        return result;
    }
 
Example 20
Source File: PrestoAdaptor.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public String toKylinTypeName(int sourceTypeId) {
    String result = "any";
    logger.info("table schema info :" + sourceTypeId);
    switch (sourceTypeId) {
    case Types.CHAR:
        result = "char";
        break;
    case Types.VARCHAR:
        result = "varchar";
        break;
    case Types.NVARCHAR:
        result = "varchar";
        break;
    case Types.LONGVARCHAR:
        result = "varchar";
        break;
    case Types.LONGNVARCHAR:
        result = "varchar";
        break;
    case Types.NUMERIC:
        result = "decimal";
        break;
    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:
        result = "real";
        break;
    case Types.FLOAT:
        result = "real";
        break;
    case Types.DOUBLE:
        result = "double";
        break;
    case Types.BINARY:
        result = "VARBINARY";
        break;
    case Types.VARBINARY:
        result = "VARBINARY";
        break;
    case Types.LONGVARBINARY:
        result = "char";
        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;
}