func MySQLCodeToJava()

in pkg/datasource/sql/types/const.go [222:281]


func MySQLCodeToJava(mysqlType MySQLDefCode) JDBCType {
	var jdbcType JDBCType

	switch mysqlType {
	case FIELD_TYPE_NEW_DECIMAL, FIELD_TYPE_DECIMAL:
		jdbcType = JDBCTypeDecimal
	case FIELD_TYPE_TINY:
		jdbcType = JDBCTypeTinyInt
	case FIELD_TYPE_SHORT:
		jdbcType = JDBCTypeSmallInt
	case FIELD_TYPE_LONG:
		jdbcType = JDBCTypeInteger
	case FIELD_TYPE_FLOAT:
		jdbcType = JDBCTypeReal
	case FIELD_TYPE_DOUBLE:
		jdbcType = JDBCTypeDouble
	case FIELD_TYPE_NULL:
		jdbcType = JDBCTypeNull
	case FIELD_TYPE_TIMESTAMP:
		jdbcType = JDBCTypeTimestamp
	case FIELD_TYPE_LONGLONG:
		jdbcType = JDBCTypeBigInt
	case FIELD_TYPE_INT24:
		jdbcType = JDBCTypeInteger
	case FIELD_TYPE_DATE:
		jdbcType = JDBCTypeDate
	case FIELD_TYPE_TIME:
		jdbcType = JDBCTypeTime
	case FIELD_TYPE_DATETIME:
		jdbcType = JDBCTypeTimestamp
	case FIELD_TYPE_YEAR:
		jdbcType = JDBCTypeDate
	case FIELD_TYPE_NEWDATE:
		jdbcType = JDBCTypeDate
	case FIELD_TYPE_ENUM:
		jdbcType = JDBCTypeChar
	case FIELD_TYPE_SET:
		jdbcType = JDBCTypeChar
	case FIELD_TYPE_TINY_BLOB:
		jdbcType = JDBCTypeVarBinary
	case FIELD_TYPE_MEDIUM_BLOB:
		jdbcType = JDBCTypeLongVarBinary
	case FIELD_TYPE_LONG_BLOB:
		jdbcType = JDBCTypeLongVarBinary
	case FIELD_TYPE_BLOB:
		jdbcType = JDBCTypeLongVarBinary
	case FIELD_TYPE_VAR_STRING, FIELD_TYPE_VARCHAR:
		jdbcType = JDBCTypeVarchar
	case FIELD_TYPE_JSON, FIELD_TYPE_STRING:
		jdbcType = JDBCTypeChar
	case FIELD_TYPE_GEOMETRY:
		jdbcType = JDBCTypeBinary
	case FIELD_TYPE_BIT:
		jdbcType = JDBCTypeBit
	default:
		jdbcType = JDBCTypeVarchar
	}

	return jdbcType
}