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


Java Types.INTEGER属性代码示例

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


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

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

示例2: 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:lamsfoundation,项目名称:lams,代码行数:36,代码来源:ResultSetMetaData.java

示例3: createProcedureColumnsFields

protected Field[] createProcedureColumnsFields() {
    Field[] fields = new Field[20];

    fields[0] = new Field("", "PROCEDURE_CAT", Types.CHAR, 512);
    fields[1] = new Field("", "PROCEDURE_SCHEM", Types.CHAR, 512);
    fields[2] = new Field("", "PROCEDURE_NAME", Types.CHAR, 512);
    fields[3] = new Field("", "COLUMN_NAME", Types.CHAR, 512);
    fields[4] = new Field("", "COLUMN_TYPE", Types.CHAR, 64);
    fields[5] = new Field("", "DATA_TYPE", Types.SMALLINT, 6);
    fields[6] = new Field("", "TYPE_NAME", Types.CHAR, 64);
    fields[7] = new Field("", "PRECISION", Types.INTEGER, 12);
    fields[8] = new Field("", "LENGTH", Types.INTEGER, 12);
    fields[9] = new Field("", "SCALE", Types.SMALLINT, 12);
    fields[10] = new Field("", "RADIX", Types.SMALLINT, 6);
    fields[11] = new Field("", "NULLABLE", Types.SMALLINT, 6);
    fields[12] = new Field("", "REMARKS", Types.CHAR, 512);
    fields[13] = new Field("", "COLUMN_DEF", Types.CHAR, 512);
    fields[14] = new Field("", "SQL_DATA_TYPE", Types.INTEGER, 12);
    fields[15] = new Field("", "SQL_DATETIME_SUB", Types.INTEGER, 12);
    fields[16] = new Field("", "CHAR_OCTET_LENGTH", Types.INTEGER, 12);
    fields[17] = new Field("", "ORDINAL_POSITION", Types.INTEGER, 12);
    fields[18] = new Field("", "IS_NULLABLE", Types.CHAR, 512);
    fields[19] = new Field("", "SPECIFIC_NAME", Types.CHAR, 512);
    return fields;
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:25,代码来源:DatabaseMetaData.java

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

示例5: insertUser

public int insertUser(User user) {
	String inserQuery = "insert into users (username, password, enabled , id) values (?, ?, ?, ?) ";
	Object[] params = new Object[]{user.getUserName(), user.getPassword(),user.isEnabled(),user.getId()};
	int[] types = new int[]{Types.VARCHAR,Types.VARCHAR,Types.BIT,Types.INTEGER};
	int number =  jdbcTemplate.update(inserQuery,params,types);
	IUserDao dao = applicationContext.getBean("userDao", IUserDao.class);
	
	//!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	/*To test the transaction propagation behaviour call another transacted method.
	 * So in this case when you call selectUser, transaction behaviour as described 
	 * in xml can be practically seen*/ 
	dao.selectUser(3);
	/////////////////// IMPORTANT/////////////////////////////
	
	return number;
}
 
开发者ID:Illusionist80,项目名称:SpringTutorial,代码行数:16,代码来源:UserDao.java

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

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

示例8: 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:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:JDBCAdapter.java

示例9: columnClassNames

@DataProvider(name = "columnClassNames")
private Object[][] columnClassNames() {
    return new Object[][]{
        {Types.CHAR, "java.lang.String"},
        {Types.NCHAR, "java.lang.String"},
        {Types.VARCHAR, "java.lang.String"},
        {Types.NVARCHAR, "java.lang.String"},
        {Types.LONGVARCHAR, "java.lang.String"},
        {Types.LONGNVARCHAR, "java.lang.String"},
        {Types.NUMERIC, "java.math.BigDecimal"},
        {Types.DECIMAL, "java.math.BigDecimal"},
        {Types.BIT, "java.lang.Boolean"},
        {Types.TINYINT, "java.lang.Byte"},
        {Types.SMALLINT, "java.lang.Short"},
        {Types.INTEGER, "java.lang.Integer"},
        {Types.FLOAT, "java.lang.Double"},
        {Types.DOUBLE, "java.lang.Double"},
        {Types.BINARY, "byte[]"},
        {Types.VARBINARY, "byte[]"},
        {Types.LONGVARBINARY, "byte[]"},
        {Types.DATE, "java.sql.Date"},
        {Types.TIME, "java.sql.Time"},
        {Types.TIMESTAMP, "java.sql.Timestamp"},
        {Types.CLOB, "java.sql.Clob"},
        {Types.BLOB, "java.sql.Blob"}

    };

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:RowSetMetaDataTests.java

示例10: getObjectToType

public static int getObjectToType(Object ob){
if (ob instanceof Integer) {
	return Types.INTEGER;
}
else if (ob instanceof Boolean) {
	return Types.BOOLEAN;
}
else if (ob instanceof Byte) {
	return Types.BIT;
}	
else if (ob instanceof Short) {
	return Types.INTEGER;
}	
else if (ob instanceof Float) {
	return Types.FLOAT;
}			
else if (ob instanceof Long) {
	return Types.BIGINT;
}
else if (ob instanceof Double) {
	return Types.DOUBLE;
}			
else if (ob instanceof Date) {
	return Types.DATE;
}	
else if (ob instanceof Time) {
	return Types.TIME;
}	
else if (ob instanceof Timestamp) {
	return Types.TIMESTAMP;
}
else if (ob instanceof String) {
	return Types.VARCHAR;
}			
else  {
	return Types.VARCHAR;
}	   
 }
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:38,代码来源:MongoData.java

示例11: getMessage

public List<Message> getMessage(User sendUser, User receiveUser, Page page) throws WebQQDaoException {
    try {
        Map<String,User> map = Maps.newHashMap();
        map.put(sendUser.getId(),sendUser);
        map.put(receiveUser.getId(),receiveUser);

        Object[] args = new Object[]{
                sendUser.getId(),
                receiveUser.getId(),
                receiveUser.getId(),
                sendUser.getId(),
                page.getCurrentPage(),
                page.getPageSize()
        };
        int[] argTypes = new int[]{
                Types.VARCHAR,
                Types.VARCHAR,
                Types.VARCHAR,
                Types.VARCHAR,
                Types.INTEGER,
                Types.INTEGER
        };
        return jdbcTemplate.query(
                SQL_GET_MESSAGE_PAGE,
                args,
                argTypes,
                (rs, i) -> getMessageByResultSet(rs)
                        .setSendUser(map.get(rs.getString("sendUserId")))
                        .setReceiveUser(map.get(rs.getString("receiveUserId")))
        );
    } catch (Exception ex) {
        throw new WebQQDaoException(SQL_GET_MESSAGE_PAGE,ex);
    }

}
 
开发者ID:damingerdai,项目名称:web-qq,代码行数:35,代码来源:MessageDaoImpl.java

示例12: toHCatType

/**
 * Resolve a database-specific type to HCat data type. Largely follows Sqoop's
 * hive translation.
 * @param sqlType
 *          sql type
 * @return hcat type
 */
public static String toHCatType(int sqlType) {
  switch (sqlType) {

  // Ideally TINYINT and SMALLINT should be mapped to their
  // HCat equivalents tinyint and smallint respectively
  // But the Sqoop Java type conversion has them mapped to Integer
  // Even though the referenced Java doc clearly recommends otherwise.
  // Changing this now can cause many of the sequence file usages to
  // break as value class implementations will change. So, we
  // just use the same behavior here.
    case Types.SMALLINT:
    case Types.TINYINT:
    case Types.INTEGER:
      return "int";

    case Types.VARCHAR:
      return "varchar";
    case Types.CHAR:
      return "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.FLOAT:
    case Types.REAL:
      return "float";

    case Types.NUMERIC:
    case Types.DECIMAL:
      return "decimal";

    case Types.DOUBLE:
      return "double";

    case Types.BIT:
    case Types.BOOLEAN:
      return "boolean";

    case Types.BIGINT:
      return "bigint";

    case Types.BINARY:
    case Types.VARBINARY:
    case Types.BLOB:
    case Types.LONGVARBINARY:
      return "binary";

    default:
      throw new IllegalArgumentException(
        "Cannot convert SQL type to HCatalog type " + sqlType);
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:65,代码来源:SqoopHCatUtilities.java

示例13: getParameterType

@Override
public int getParameterType(int param) throws SQLException
{
	Integer type = statement.getParameterStore().getType(param);
	if (type != null)
		return type.intValue();

	Object value = statement.getParameterStore().getParameter(param);
	if (value == null)
	{
		return Types.OTHER;
	}
	else if (Boolean.class.isAssignableFrom(value.getClass()))
	{
		return Types.BOOLEAN;
	}
	else if (Byte.class.isAssignableFrom(value.getClass()))
	{
		return Types.TINYINT;
	}
	else if (Short.class.isAssignableFrom(value.getClass()))
	{
		return Types.SMALLINT;
	}
	else if (Integer.class.isAssignableFrom(value.getClass()))
	{
		return Types.INTEGER;
	}
	else if (Long.class.isAssignableFrom(value.getClass()))
	{
		return Types.BIGINT;
	}
	else if (Float.class.isAssignableFrom(value.getClass()))
	{
		return Types.FLOAT;
	}
	else if (Double.class.isAssignableFrom(value.getClass()))
	{
		return Types.DOUBLE;
	}
	else if (BigDecimal.class.isAssignableFrom(value.getClass()))
	{
		return Types.DECIMAL;
	}
	else if (Date.class.isAssignableFrom(value.getClass()))
	{
		return Types.DATE;
	}
	else if (Timestamp.class.isAssignableFrom(value.getClass()))
	{
		return Types.TIMESTAMP;
	}
	else if (Time.class.isAssignableFrom(value.getClass()))
	{
		return Types.TIME;
	}
	else if (String.class.isAssignableFrom(value.getClass()))
	{
		return Types.NVARCHAR;
	}
	else if (byte[].class.isAssignableFrom(value.getClass()))
	{
		return Types.BINARY;
	}
	else
	{
		return Types.OTHER;
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:69,代码来源:CloudSpannerParameterMetaData.java

示例14: makeDbColDefinition

public BaseDbColDefinition makeDbColDefinition()
{
	BaseDbColDefinition dbColDef = null;
	if(m_nTypeId == Types.CHAR)
	{
		dbColDef = new DbColDefinitionChar(this);
	}
	else if(m_nTypeId == Types.DECIMAL)	// Unsupported type in jlib, but supported in nacaRT
	{
		dbColDef = new DbColDefinitionDecimal(this);
	}			
	else if(m_nTypeId == Types.TIME)
	{
		dbColDef = new DbColDefinitionTime(this);
	}
	else if(m_nTypeId == Types.TIMESTAMP)
	{
		dbColDef = new DbColDefinitionTimestamp(this);
	}
	else if(m_nTypeId == Types.DATE)
	{
		dbColDef = new DbColDefinitionDate(this);
	}
	else if(m_nTypeId == Types.VARCHAR)
	{
		dbColDef = new DbColDefinitionVarchar(this);
	}
	else if(m_nTypeId == Types.LONGVARCHAR)
	{
		dbColDef = new DbColDefinitionLongVarchar(this);
	}
	else if(m_nTypeId == Types.SMALLINT)
	{
		dbColDef = new DbColDefinitionSmallint(this);
	}
	else if(m_nTypeId == Types.INTEGER)
	{
		dbColDef = new DbColDefinitionInteger(this);
	}
	else if(m_nTypeId == Types.DOUBLE)
	{
		dbColDef = new DbColDefinitionDouble(this);
	}

	return dbColDef;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:46,代码来源:ColDescriptionInfo.java

示例15: toJavaType

/**
 * Resolve a database-specific type to the Java type that should contain it.
 * @param sqlType     sql type
 * @return the name of a Java type to hold the sql datatype, or null if none.
 */
public String toJavaType(int sqlType) {
  // Mappings taken from:
  // http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html
  if (sqlType == Types.INTEGER) {
    return "Integer";
  } else if (sqlType == Types.VARCHAR) {
    return "String";
  } else if (sqlType == Types.CHAR) {
    return "String";
  } else if (sqlType == Types.LONGVARCHAR) {
    return "String";
  } else if (sqlType == Types.NVARCHAR) {
    return "String";
  } else if (sqlType == Types.NCHAR) {
    return "String";
  } else if (sqlType == Types.LONGNVARCHAR) {
    return "String";
  } else if (sqlType == Types.NUMERIC) {
    return "java.math.BigDecimal";
  } else if (sqlType == Types.DECIMAL) {
    return "java.math.BigDecimal";
  } else if (sqlType == Types.BIT) {
    return "Boolean";
  } else if (sqlType == Types.BOOLEAN) {
    return "Boolean";
  } else if (sqlType == Types.TINYINT) {
    return "Integer";
  } else if (sqlType == Types.SMALLINT) {
    return "Integer";
  } else if (sqlType == Types.BIGINT) {
    return "Long";
  } else if (sqlType == Types.REAL) {
    return "Float";
  } else if (sqlType == Types.FLOAT) {
    return "Double";
  } else if (sqlType == Types.DOUBLE) {
    return "Double";
  } else if (sqlType == Types.DATE) {
    return "java.sql.Date";
  } else if (sqlType == Types.TIME) {
    return "java.sql.Time";
  } else if (sqlType == Types.TIMESTAMP) {
    return "java.sql.Timestamp";
  } else if (sqlType == Types.BINARY
      || sqlType == Types.VARBINARY) {
    return BytesWritable.class.getName();
  } else if (sqlType == Types.CLOB) {
    return ClobRef.class.getName();
  } else if (sqlType == Types.BLOB
      || sqlType == Types.LONGVARBINARY) {
    return BlobRef.class.getName();
  } else {
    // TODO(aaron): Support DISTINCT, ARRAY, STRUCT, REF, JAVA_OBJECT.
    // Return null indicating database-specific manager should return a
    // java data type if it can find one for any nonstandard type.
    return null;
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:63,代码来源:ConnManager.java


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