当前位置: 首页>>代码示例>>Java>>正文


Java Types.REAL属性代码示例

本文整理汇总了Java中java.sql.Types.REAL属性的典型用法代码示例。如果您正苦于以下问题:Java Types.REAL属性的具体用法?Java Types.REAL怎么用?Java Types.REAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.sql.Types的用法示例。


在下文中一共展示了Types.REAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isDecimalType

/**
 * Checks if the SQL Type is a Decimal/Number Type
 * 
 * @param type
 *            SQL Type
 */
private static final boolean isDecimalType(int type) {
    switch (type) {
        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:
            return true;
    }

    return false;
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:23,代码来源:ResultSetMetaData.java

示例2: determineNeedsQuoting

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;

}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:22,代码来源:Field.java

示例3: getCastTypeName

@Override
public String getCastTypeName(int code) {
	switch ( code ) {
		case Types.INTEGER:
		case Types.BIGINT:
		case Types.SMALLINT:
			return "signed";
		case Types.FLOAT:
		case Types.NUMERIC:
		case Types.REAL:
			return "decimal";
		case Types.VARCHAR:
			return "char";
		case Types.VARBINARY:
			return "binary";
		default:
			return super.getCastTypeName( code );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:MySQLDialect.java

示例4: isSigned

/**
 * Is the column a signed number?
 * 
 * @param column
 *            the first column is 1, the second is 2...
 * 
 * @return true if so
 * 
 * @throws SQLException
 *             if a database access error occurs
 */
public boolean isSigned(int column) throws SQLException {
    Field f = getField(column);
    int sqlType = f.getSQLType();

    switch (sqlType) {
        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:
            return !f.isUnsigned();

        case Types.DATE:
        case Types.TIME:
        case Types.TIMESTAMP:
            return false;

        default:
            return false;
    }
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:36,代码来源:ResultSetMetaData.java

示例5: getSplitter

/**
 * @return the DBSplitter implementation to use to divide the table/query into InputSplits.
 */
protected DBSplitter getSplitter(int sqlDataType) {
  switch (sqlDataType) {
  case Types.NUMERIC:
  case Types.DECIMAL:
    return new BigDecimalSplitter();

  case Types.BIT:
  case Types.BOOLEAN:
    return new BooleanSplitter();

  case Types.INTEGER:
  case Types.TINYINT:
  case Types.SMALLINT:
  case Types.BIGINT:
    return new IntegerSplitter();

  case Types.REAL:
  case Types.FLOAT:
  case Types.DOUBLE:
    return new FloatSplitter();

  case Types.CHAR:
  case Types.VARCHAR:
  case Types.LONGVARCHAR:
    return new TextSplitter();

  case Types.DATE:
  case Types.TIME:
  case Types.TIMESTAMP:
    return new DateSplitter();

  default:
    // TODO: Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT, CLOB, BLOB, ARRAY
    // STRUCT, REF, DATALINK, and JAVA_OBJECT.
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:40,代码来源:DataDrivenDBInputFormat.java

示例6: isCaseSensitive

/**
 * Does a column's case matter?
 * 
 * @param column
 *            the first column is 1, the second is 2...
 * 
 * @return true if so
 * 
 * @throws java.sql.SQLException
 *             if a database access error occurs
 */
public boolean isCaseSensitive(int column) throws java.sql.SQLException {
    Field field = getField(column);

    int sqlType = field.getSQLType();

    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.DATE:
        case Types.TIME:
        case Types.TIMESTAMP:
            return false;

        case Types.CHAR:
        case Types.VARCHAR:
        case Types.LONGVARCHAR:

            if (field.isBinary()) {
                return true;
            }

            String collationName = field.getCollation();

            return ((collationName != null) && !collationName.endsWith("_ci"));

        default:
            return true;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:ResultSetMetaData.java

示例7: literalize

private String literalize(List<String> v, int type){
	StringJoiner sj = new StringJoiner(",", "(",")");
	if(type == Types.NUMERIC || type == Types.BIGINT || type == Types.BIT || type == Types.DECIMAL
			|| type == Types.DOUBLE || type == Types.FLOAT || type == Types.INTEGER || type == Types.REAL || type == Types.ROWID
			|| type == Types.SMALLINT || type == Types.TINYINT){


		v.forEach(s -> sj.add(s) );
	}else{
		v.forEach(s -> sj.add("'" + s + "'") );
	}
	return sj.toString();
}
 
开发者ID:ajoabraham,项目名称:hue,代码行数:13,代码来源:JoinDetector.java

示例8: throwRangeException

private void throwRangeException(String valueAsString, int columnIndex, int jdbcType) throws SQLException {
    String datatype = null;

    switch (jdbcType) {
        case Types.TINYINT:
            datatype = "TINYINT";
            break;
        case Types.SMALLINT:
            datatype = "SMALLINT";
            break;
        case Types.INTEGER:
            datatype = "INTEGER";
            break;
        case Types.BIGINT:
            datatype = "BIGINT";
            break;
        case Types.REAL:
            datatype = "REAL";
            break;
        case Types.FLOAT:
            datatype = "FLOAT";
            break;
        case Types.DOUBLE:
            datatype = "DOUBLE";
            break;
        case Types.DECIMAL:
            datatype = "DECIMAL";
            break;
        default:
            datatype = " (JDBC type '" + jdbcType + "')";
    }

    throw SQLError.createSQLException("'" + valueAsString + "' in column '" + columnIndex + "' is outside valid range for the datatype " + datatype + ".",
            SQLError.SQL_STATE_NUMERIC_VALUE_OUT_OF_RANGE, getExceptionInterceptor());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:ResultSetImpl.java

示例9: getObject

@Override
public Object getObject( int columnIndex ) throws SQLException {
  throwIfClosed();

  final Cursor.Accessor accessor;
  try {
    accessor = accessorList.get(columnIndex - 1);
  } catch (IndexOutOfBoundsException e) {
    throw new SQLException("invalid column ordinal: " + columnIndex);
  }
  final ColumnMetaData metaData = columnMetaDataList.get(columnIndex - 1);
  // Dremio returns a float (4bytes) for a SQL Float whereas Calcite would return a double (8bytes)
  int typeId = (metaData.type.id != Types.FLOAT) ? metaData.type.id : Types.REAL;
  return AvaticaSite.get(accessor, typeId, localCalendar);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:15,代码来源:DremioResultSetImpl.java

示例10: getSelectClauseNullString

@Override
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;
		default:
			break;
	}
	return v;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:47,代码来源:TeradataDialect.java

示例11: setParamValue

private void setParamValue(PreparedStatement ps, int psIdx, ResultSetRow row, int rsIdx, int sqlType) throws SQLException {
    byte[] val = row.getColumnValue(rsIdx);
    if (val == null) {
        ps.setNull(psIdx, Types.NULL);
        return;
    }
    switch (sqlType) {
        case Types.NULL:
            ps.setNull(psIdx, Types.NULL);
            break;
        case Types.TINYINT:
        case Types.SMALLINT:
        case Types.INTEGER:
            ps.setInt(psIdx, row.getInt(rsIdx));
            break;
        case Types.BIGINT:
            ps.setLong(psIdx, row.getLong(rsIdx));
            break;
        case Types.CHAR:
        case Types.VARCHAR:
        case Types.LONGVARCHAR:
        case Types.DECIMAL:
        case Types.NUMERIC:
            ps.setString(psIdx, row.getString(rsIdx, this.charEncoding, this.connection));
            break;
        case Types.DATE:
            ps.setDate(psIdx, row.getDateFast(rsIdx, this.connection, this, this.fastDefaultCal), this.fastDefaultCal);
            break;
        case Types.TIMESTAMP:
            ps.setTimestamp(psIdx, row.getTimestampFast(rsIdx, this.fastDefaultCal, this.connection.getDefaultTimeZone(), false, this.connection, this));
            break;
        case Types.TIME:
            ps.setTime(psIdx, row.getTimeFast(rsIdx, this.fastDefaultCal, this.connection.getDefaultTimeZone(), false, this.connection, this));
            break;
        case Types.FLOAT:
        case Types.DOUBLE:
        case Types.REAL:
        case Types.BOOLEAN:
            ps.setBytesNoEscapeNoQuotes(psIdx, val);
            break;
        /*
         * default, but also explicitly for following types:
         * case Types.BINARY:
         * case Types.BLOB:
         */
        default:
            ps.setBytes(psIdx, val);
            break;
    }

}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:51,代码来源:UpdatableResultSet.java

示例12: getSplitter

/**
 * @return the DBSplitter implementation to use to divide the table/query
 * into InputSplits.
 */
public DBSplitter getSplitter(int sqlDataType, long splitLimit, String rangeStyle) {
  switch (sqlDataType) {
      case Types.NUMERIC:
      case Types.DECIMAL:
        if(splitLimit >= 0) {
          throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
        }
        return new BigDecimalSplitter();

      case Types.BIT:
      case Types.BOOLEAN:
        if(splitLimit >= 0) {
          throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
        }
      return new BooleanSplitter();

      case Types.INTEGER:
      case Types.TINYINT:
      case Types.SMALLINT:
      case Types.BIGINT:
        return new IntegerSplitter();

      case Types.REAL:
      case Types.FLOAT:
      case Types.DOUBLE:
        if(splitLimit >= 0) {
          throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
        }
        return new FloatSplitter();

      case Types.NVARCHAR:
      case Types.NCHAR:
        if(splitLimit >= 0) {
          throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
        }
        return new NTextSplitter(rangeStyle);

      case Types.CHAR:
      case Types.VARCHAR:
      case Types.LONGVARCHAR:
        if(splitLimit >= 0) {
           throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
        }
        return new TextSplitter(rangeStyle);

      case Types.DATE:
      case Types.TIME:
      case Types.TIMESTAMP:
        return new DateSplitter();

      default:
      // TODO: Support BINARY, VARBINARY, LONGVARBINARY, DISTINCT, CLOB,
      // BLOB, ARRAY, STRUCT, REF, DATALINK, and JAVA_OBJECT.
      if(splitLimit >= 0) {
      throw new IllegalArgumentException("split-limit is supported only with Integer and Date columns");
      }
      return null;
  }
}
 
开发者ID:BriData,项目名称:DBus,代码行数:63,代码来源:DataDrivenDBInputFormat.java

示例13: jdbcTypeToClass

/**
 * Get the Java type which corresponds to given SQL type.
 * @param type SQL type
 * @return The Java type
 */
public static Class<?> jdbcTypeToClass(int type) {
	Class<?> result = Object.class;

	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.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;
	default:
		break;
	}

	return result;
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jdbc,代码行数:72,代码来源:JdbcDatastoreUtils.java

示例14: getFieldType

/**
 * 根据Types获取字段类型
 *
 * @see Types
 * @return 对应字段的java类型
 */
public static FieldType getFieldType(Integer sqlType) {
    FieldType fieldType = sqlTypes.get("UNKNOWN");
    if (sqlType == null) {
        return fieldType;
    }

    // https://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html
    if (sqlType == Types.INTEGER) {
        fieldType = sqlTypes.get("INTEGER");
    } else if (sqlType == Types.VARCHAR) {
        fieldType = sqlTypes.get("STRING");
    } else if (sqlType == Types.CHAR) {
        fieldType = sqlTypes.get("STRING");
    } else if (sqlType == Types.LONGVARCHAR) {
        fieldType = sqlTypes.get("STRING");
    } else if (sqlType == Types.NVARCHAR) {
        fieldType = sqlTypes.get("STRING");
    } else if (sqlType == Types.NCHAR) {
        fieldType = sqlTypes.get("STRING");
    } else if (sqlType == Types.LONGNVARCHAR) {
        fieldType = sqlTypes.get("STRING");
    } else if (sqlType == Types.NUMERIC) {
        fieldType = sqlTypes.get("DECIMAL");
    } else if (sqlType == Types.DECIMAL) {
        fieldType = sqlTypes.get("DECIMAL");
    } else if (sqlType == Types.BIT) {
        fieldType = sqlTypes.get("BOOLEAN");
    } else if (sqlType == Types.BOOLEAN) {
        fieldType = sqlTypes.get("BOOLEAN");
    } else if (sqlType == Types.TINYINT) {
        fieldType = sqlTypes.get("INTEGER");
    } else if (sqlType == Types.SMALLINT) {
        fieldType = sqlTypes.get("INTEGER");
    } else if (sqlType == Types.BIGINT) {
        fieldType = sqlTypes.get("BIGINT");
    } else if (sqlType == Types.REAL) {
        fieldType = sqlTypes.get("REAL");
    } else if (sqlType == Types.FLOAT) {
        fieldType = sqlTypes.get("FLOAT");
    } else if (sqlType == Types.DOUBLE) {
        fieldType = sqlTypes.get("DOUBLE");
    } else if (sqlType == Types.DATE) {
        // java.sql.Date ?
        fieldType = sqlTypes.get("DATE");
    } else if (sqlType == Types.TIME) {
        // java.sql.Time ?
        fieldType = sqlTypes.get("TIME");
    } else if (sqlType == Types.TIMESTAMP) {
        // java.sql.Timestamp ?
        fieldType = sqlTypes.get("TIMESTAMP");
    } else if (sqlType == Types.BINARY
            || sqlType == Types.VARBINARY) {
        fieldType = sqlTypes.get("BINARY");
    } else if (sqlType == Types.CLOB) {
        fieldType = sqlTypes.get("CLOB");
    } else if (sqlType == Types.BLOB
            || sqlType == Types.LONGVARBINARY) {
        fieldType = sqlTypes.get("BLOB");
    } else {
        // DISTINCT, ARRAY, STRUCT, REF, JAVA_OBJECT.
        return fieldType;
    }
    return fieldType;
}
 
开发者ID:hykes,项目名称:CodeGen,代码行数:70,代码来源:ParserUtils.java

示例15: next

@Override
public boolean next() throws OdaException
{
	if( currentRow >= maxRows )
	{
		return false;
	}
	try
	{
		if( resultSet.next() )
		{
			currentRow++;
			for( int i = 1; i <= numCols; i++ )
			{
				int type = metaData.getColumnType(i);
				Object obj;
				switch( type )
				{
					case Types.TIMESTAMP:
						obj = resultSet.getTimestamp(i);
						break;
					case Types.FLOAT:
					case Types.REAL:
					case Types.DOUBLE:
						obj = resultSet.getDouble(i);
						break;
					case Types.INTEGER:
					case Types.SMALLINT:
					case Types.TINYINT:
						obj = resultSet.getInt(i);
						break;
					case Types.BIGINT:
					case Types.DECIMAL:
					case Types.NUMERIC:
						obj = resultSet.getBigDecimal(i);
						break;
					case Types.BOOLEAN:
					case Types.BIT:
						obj = resultSet.getBoolean(i) ? 1 : 0;
						break;
					default:
						obj = resultSet.getString(i);
						break;
				}
				rowData[i - 1] = obj;
			}
			return true;
		}
		return false;
	}
	catch( SQLException sqle )
	{
		throw new OdaException(sqle);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:55,代码来源:JDBCOdaResultSet.java


注:本文中的java.sql.Types.REAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。