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


Java Types.DOUBLE属性代码示例

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


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

示例1: getColumnTypeName

@Override
public String getColumnTypeName(int column) throws SQLException {
	// 数据库特定的类型名称
	switch (keytype[column-1]){
	case  Types.INTEGER: return "INTEGER";
	case  Types.BOOLEAN:  return "BOOLEAN";
	case  Types.BIT: return "BITT"; 
	case  Types.FLOAT: return "FLOAT";
	case  Types.BIGINT: return "BIGINT";
	case  Types.DOUBLE:  return "DOUBLE";
	case  Types.DATE: return "DATE"; 
	case  Types.TIME: return "TIME";
	case  Types.TIMESTAMP: return "TIMESTAMP";
	default: return "varchar";
   }
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:16,代码来源:MongoResultSetMetaData.java

示例2: isOrdinal

private boolean isOrdinal(int paramType) {
	switch ( paramType ) {
		case Types.INTEGER:
		case Types.NUMERIC:
		case Types.SMALLINT:
		case Types.TINYINT:
		case Types.BIGINT:
		case Types.DECIMAL: //for Oracle Driver
		case Types.DOUBLE:  //for Oracle Driver
		case Types.FLOAT:   //for Oracle Driver
			return true;
		case Types.CHAR:
		case Types.LONGVARCHAR:
		case Types.VARCHAR:
			return false;
		default:
			throw new HibernateException( "Unable to persist an Enum in a column of SQL Type: " + paramType );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:EnumType.java

示例3: 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:Jugendhackt,项目名称:OpenVertretung,代码行数:23,代码来源:ResultSetMetaData.java

示例4: isNumeric

public static boolean isNumeric(int jdbcType) {
    switch (jdbcType) {
        case Types.BIT:
        case Types.BIGINT:
        case Types.BOOLEAN:
        case Types.INTEGER:
        case Types.SMALLINT:
        case Types.TINYINT:
        case Types.FLOAT:
        case Types.REAL:
        case Types.DOUBLE:
        case Types.DECIMAL:
        case Types.NUMERIC:
            return true;

        default:
            return false;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:DataViewUtils.java

示例5: getObject

public Object getObject(int parameterIndex) throws SQLException {
    checkBounds(parameterIndex, 0);

    if (this.parameterIsNull[parameterIndex - 1]) {
        return null;
    }

    // we can't rely on the default mapping for JDBC's ResultSet.getObject() for numerics, they're not one-to-one with PreparedStatement.setObject

    switch (PreparedStatement.this.parameterTypes[parameterIndex - 1]) {
        case Types.TINYINT:
            return Byte.valueOf(getByte(parameterIndex));
        case Types.SMALLINT:
            return Short.valueOf(getShort(parameterIndex));
        case Types.INTEGER:
            return Integer.valueOf(getInt(parameterIndex));
        case Types.BIGINT:
            return Long.valueOf(getLong(parameterIndex));
        case Types.FLOAT:
            return Float.valueOf(getFloat(parameterIndex));
        case Types.DOUBLE:
            return Double.valueOf(getDouble(parameterIndex));
        default:
            return this.bindingsAsRs.getObject(parameterIndex);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:PreparedStatement.java

示例6: setDouble

/**
 * Set a parameter to a Java double value. The driver converts this to a SQL
 * DOUBLE value when it sends it to the database
 * 
 * @param parameterIndex
 *            the first parameter is 1...
 * @param x
 *            the parameter value
 * 
 * @exception SQLException
 *                if a database access error occurs
 */
public void setDouble(int parameterIndex, double x) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        if (!this.connection.getAllowNanAndInf() && (x == Double.POSITIVE_INFINITY || x == Double.NEGATIVE_INFINITY || Double.isNaN(x))) {
            throw SQLError.createSQLException("'" + x + "' is not a valid numeric or approximate numeric value", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
                    getExceptionInterceptor());

        }

        setInternal(parameterIndex, StringUtils.fixDecimalExponent(String.valueOf(x)));

        this.parameterTypes[parameterIndex - 1 + getParameterIndexOffset()] = Types.DOUBLE;
    }
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:25,代码来源:PreparedStatement.java

示例7: renderArgument

@Override
protected String renderArgument(String argument, int firstArgumentJdbcType) {
	if ( firstArgumentJdbcType == Types.DOUBLE || firstArgumentJdbcType == Types.FLOAT ) {
		return argument;
	}
	else {
		return "cast(" + argument + " as " + castType + ")";
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:AvgWithArgumentCastFunction.java

示例8: isFloatingPointNumber

@Override
public boolean isFloatingPointNumber(int index) throws SQLException {
    if (this.isBinaryEncoded) {
        switch (this.metadata[index].getSQLType()) {
            case Types.FLOAT:
            case Types.DOUBLE:
            case Types.DECIMAL:
            case Types.NUMERIC:
                return true;
            default:
                return false;
        }
    }

    findAndSeekToOffset(index);

    long length = this.rowFromServer.readFieldLength();

    if (length == Buffer.NULL_LENGTH) {
        return false;
    }

    if (length == 0) {
        return false;
    }

    int offset = this.rowFromServer.getPosition();
    byte[] buffer = this.rowFromServer.getByteBuffer();

    for (int i = 0; i < (int) length; i++) {
        char c = (char) buffer[offset + i];

        if ((c == 'e') || (c == 'E')) {
            return true;
        }
    }

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

示例9: dbRepresentation

public String dbRepresentation(int column, Object value) {
    int type;

    if (value == null) {
        return "null";
    }

    try {
        type = metaData.getColumnType(column + 1);
    } catch (SQLException e) {
        return value.toString();
    }

    switch (type) {
        case Types.INTEGER:
        case Types.DOUBLE:
        case Types.FLOAT:
            return value.toString();
        case Types.BIT:
            return ((Boolean) value).booleanValue() ? "1" : "0";
        case Types.DATE:
            return value.toString(); // This will need some conversion.
        default:
            return "\"" + value.toString() + "\"";
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:JDBCAdapter.java

示例10: 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:rafallis,项目名称:BibliotecaPS,代码行数:35,代码来源:ResultSetImpl.java

示例11: isPrecisionRequired

public static boolean isPrecisionRequired(int jdbcType) {
    switch (jdbcType) {
        case Types.BIGINT:
        case Types.BOOLEAN:
        case Types.INTEGER:
        case Types.SMALLINT:
        case Types.TINYINT:
        case Types.FLOAT:
        case Types.REAL:
        case Types.DOUBLE:
        case Types.DATE:
        case Types.TIMESTAMP:
        case Types.JAVA_OBJECT:
        case Types.LONGVARCHAR:
        case Types.LONGVARBINARY:
        case Types.BLOB:
        case Types.CLOB:
        case Types.ARRAY:
        case Types.STRUCT:
        case Types.DISTINCT:
        case Types.REF:
        case Types.DATALINK:
            return false;

        default:
            return true;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:DataViewUtils.java

示例12: isNumericType

public static boolean isNumericType(int columnType) {

	if (columnType == Types.SMALLINT || columnType == Types.INTEGER
		|| columnType == Types.NUMERIC || columnType == Types.DECIMAL
		|| columnType == Types.BIGINT || columnType == Types.REAL
		|| columnType == Types.FLOAT || columnType == Types.DOUBLE) {
	    return true;
	} else {
	    return false;
	}

    }
 
开发者ID:kawansoft,项目名称:aceql-http,代码行数:12,代码来源:ResultSetWriter.java

示例13: getColumnClass

@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;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:37,代码来源:JDBCAdapter.java

示例14: 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

示例15: setObject

@Override
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
{
    checkParameterBounds(parameterIndex);
    switch(targetSqlType)
    {
        case Types.TINYINT:
            setByte(parameterIndex, ((Byte)x).byteValue());
            break;
        case Types.SMALLINT:
            setShort(parameterIndex, ((Short)x).shortValue());
            break;
        case Types.INTEGER:
            setInt(parameterIndex, ((Integer)x).intValue());
            break;
        case Types.BIGINT:
            setLong(parameterIndex, ((Long)x).longValue());
            break;
        case Types.DOUBLE:
            setDouble(parameterIndex, ((Double)x).doubleValue());
            break;
        case Types.DECIMAL:
            setBigDecimal(parameterIndex, (BigDecimal)x);
            break;
        case Types.TIMESTAMP:
            setTimestamp(parameterIndex, (Timestamp)x);
            break;
        case Types.VARBINARY:
        case Types.VARCHAR:
        case Types.NVARCHAR:
            setString(parameterIndex, (String)x);
            break;
        default:
            throw SQLError.get(SQLError.ILLEGAL_ARGUMENT);
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:36,代码来源:JDBC4PreparedStatement.java


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