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


Java JdbcUtils.getResultSetValue方法代码示例

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


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

示例1: mapRow

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
@Override
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
    T mappedObject = this.entityMapper.createInstance();
    ResultSetMetaData rsmd = rs.getMetaData();
    int columnCount = rsmd.getColumnCount();
    Map<String, Class<?>> types = this.entityMapper.types();

    this.entityMapper.startMapping(mappedObject);
    for (int index = 1; index <= columnCount; index++) {
        String column = JdbcUtils.lookupColumnName(rsmd, index);
        Object value = JdbcUtils.getResultSetValue(rs, index, types.get(column));

        this.entityMapper.setValue(mappedObject, column, value);
    }
    this.entityMapper.finishMapping(mappedObject);
    return mappedObject;
}
 
开发者ID:cybozu,项目名称:spring-data-jdbc-template,代码行数:18,代码来源:EntityRowMapper.java

示例2: mapRow

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
/**
 * <B>方法名称:</B>映射行数据<BR>
 * <B>概要说明:</B><BR>
 * 
 * @param rs 结果集
 * @param row 行号
 * @return JSONObject 数据
 * @throws SQLException SQL异常错误
 * @see RowMapper#mapRow(ResultSet,
 *      int)
 */
public JSONObject mapRow(ResultSet rs, int row) throws SQLException {
    String key = null;
    Object obj = null;
    JSONObject json = new JSONObject();
    ResultSetMetaData rsmd = rs.getMetaData();
    int count = rsmd.getColumnCount();
    for (int i = 1; i <= count; i++) {
        key = JdbcUtils.lookupColumnName(rsmd, i);
        obj = JdbcUtils.getResultSetValue(rs, i);
        try {
            json.put(key, obj);
        }
        catch (JSONException e) {
        }
    }
    return json;
}
 
开发者ID:craware,项目名称:webapp-tyust,代码行数:29,代码来源:JsonRowMapper.java

示例3: mapRow

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
public Object mapRow(ResultSet rs, int rowNumber) throws SQLException {
	Object mappedObject = instantiateClass(this.mappedClass);
	MetaObject metaObject = SystemMetaObject.forObject(mappedObject);
	ResultSetMetaData rsmd = rs.getMetaData();
	int columnCount = rsmd.getColumnCount();
	for (int index = 1; index <= columnCount; index++) {
		String column = JdbcUtils.lookupColumnName(rsmd, index).toLowerCase(Locale.ENGLISH);
		String property = mappedFields.get(column);
		if (StringUtils.isBlank(property)) {
			property = column;
		}
		if (metaObject.hasSetter(property)) {
			Class<?> type = metaObject.getSetterType(property);
			Object obj = JdbcUtils.getResultSetValue(rs, index, type);
			if (obj != null) {
				metaObject.setValue(property, obj);
			}
		}
	}
	return mappedObject;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:22,代码来源:BeanPropertyRowMapper.java

示例4: getResultSetValue

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
public static Object getResultSetValue(ResultSet rs, int index, Class<?> requiredType, ZoneId zoneId) throws SQLException {
    if (LocalDateTime.class.equals(requiredType)) {
        return getAsLocalDateTime(rs, index);
    } else if (LocalDate.class.equals(requiredType)) {
        return getAsLocalDate(rs, index);
    } else if (LocalTime.class.equals(requiredType)) {
        return getAsLocalTime(rs, index);
    } else if (OffsetDateTime.class.equals(requiredType)) {
        return getAsOffsetDateTime(rs, index, zoneId);
    } else if (OffsetTime.class.equals(requiredType)) {
        return getAsOffsetTime(rs, index, zoneId);
    } else if (ZonedDateTime.class.equals(requiredType)) {
        return getAsZonedDateTime(rs, index, zoneId);
    }

    return JdbcUtils.getResultSetValue(rs, index, requiredType);
}
 
开发者ID:cero-t,项目名称:sqltemplate,代码行数:18,代码来源:Jsr310JdbcUtils.java

示例5: mapRow

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
@Override
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
	ResultSetMetaData metaData = rs.getMetaData();
	int columns = metaData.getColumnCount();
	if (columns != 1) {
		throw new IncorrectResultSetColumnCountException(1, columns);
	}
	return JdbcUtils.getResultSetValue(rs, 1);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:DataSourceHealthIndicator.java

示例6: mapRow

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
@Override
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
	int columnSize = rs.getMetaData().getColumnCount();
	Object array = Array.newInstance(componentType, columnSize);
	for (int i = 0; i < columnSize; i++) {
		Object value = JdbcUtils.getResultSetValue(rs, (i + 1),
				componentType);
		Array.set(array, i, value);
	}
	return array;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:12,代码来源:ArrayRowMapper.java

示例7: getFieldValue

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
public Object getFieldValue(String field)  {
Integer index = fieldIndex.get(field);

if (index == null || index.intValue() < 0) {
	throw new IllegalArgumentException("invalid field=" + field);
}

try {
	return JdbcUtils.getResultSetValue(resultSet, index);
} catch (SQLException e) {
	throw new SQLExceptionCarrier(e);
}
  }
 
开发者ID:sogou-biztech,项目名称:compass,代码行数:14,代码来源:ResultSetAccessor.java

示例8: getColumnValue

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
protected String getColumnValue(ResultSet rs, int index) throws SQLException {
	Object value = JdbcUtils.getResultSetValue(rs, index);

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

	return value.toString();
}
 
开发者ID:SmarterApp,项目名称:TechnologyReadinessTool,代码行数:11,代码来源:BaseDataRetrieverImpl.java

示例9: getColumnValue

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
@Override
protected Object getColumnValue(ResultSet rs, int index, Class<?> requiredType) throws SQLException {
    if (requiredType != null) {
        return Jsr310JdbcUtils.getResultSetValue(rs, index, requiredType, zoneId);
    }
    return JdbcUtils.getResultSetValue(rs, index);
}
 
开发者ID:cero-t,项目名称:sqltemplate,代码行数:8,代码来源:SingleColumnMapper.java

示例10: getResultSetValue

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
public static <T> T getResultSetValue(final ResultSet rs, final int index, final Class<T> requiredType)
        throws SQLException {
    return (T) JdbcUtils.getResultSetValue(rs, index, requiredType);
}
 
开发者ID:Eulbobo,项目名称:java-samples,代码行数:5,代码来源:MapperUtils.java

示例11: getColumnValue

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
protected Object getColumnValue(ResultSet rs, int index, PropertyDescriptor pd) throws SQLException {
	return JdbcUtils.getResultSetValue(rs, index, pd.getPropertyType());
}
 
开发者ID:thinking-github,项目名称:nbone,代码行数:4,代码来源:EntityPropertyRowMapper.java

示例12: getColumnValue

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
protected Object getColumnValue(ResultSet rs, int index)
        throws SQLException {
    return JdbcUtils.getResultSetValue(rs, index);
}
 
开发者ID:edagarli,项目名称:Nicole,代码行数:5,代码来源:MiniColumnOriginalMapRowMapper.java

示例13: getColumnValue

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
protected Object getColumnValue(ResultSet rs, int index)
		throws SQLException {
	return JdbcUtils.getResultSetValue(rs, index);
}
 
开发者ID:East196,项目名称:maker,代码行数:5,代码来源:MiniColumnOriginalMapRowMapper.java

示例14: getObject

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
public Object getObject(ResultSet rs) throws SQLException {
	int columnIdx = rs.findColumn(name);
	return JdbcUtils.getResultSetValue(rs, columnIdx, paramType);
}
 
开发者ID:digitalfondue,项目名称:npjt-extra,代码行数:5,代码来源:DefaultMapper.java

示例15: extractData

import org.springframework.jdbc.support.JdbcUtils; //导入方法依赖的package包/类
@Override
public ArrayList<EntityData> extractData(ResultSet rs) throws SQLException, DataAccessException {
    checkForInterruption();
    ResultSetMetaData meta = rs.getMetaData();
    Map<Integer, String> columnHints = getSqlColumnEntityHints(sqlToExecute);
    ArrayList<String> attributeIds = getAttributeIds(sqlToExecute, meta, columnHints);
    long ts = System.currentTimeMillis();
    while (rs.next()) {
        if (outputRecCount++ % rowsPerMessage == 0 && payload != null && !payload.isEmpty()) {
            callback.sendEntityDataMessage(null, payload);
            payload.clear();
        }

        getComponentStatistics().incrementNumberEntitiesProcessed(threadNumber);

        EntityData rowData = new EntityData();
        rowData.setChangeType(entityChangeType);
        for (int i = 1; i <= meta.getColumnCount(); i++) {
            String attributeId = attributeIds.get(i - 1);
            if (isNotBlank(attributeId)) {
                Object value = JdbcUtils.getResultSetValue(rs, i);
                if (trimColumns && value instanceof String) {
                    value = value.toString().trim();
                }
                rowData.put(attributeId, value);
            }
        }
        rowReadDuringHandle++;
        payload.add(rowData);
        if (context.getDeployment() != null && context.getDeployment().asLogLevel() == LogLevel.DEBUG) {
            logEntityAttributes(rowData);
        }

        long newTs = System.currentTimeMillis();
        if (newTs - ts > 10000) {
            getExecutionTracker().updateStatistics(threadNumber, context);
            ts = newTs;
        }
    }
    return payload;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:42,代码来源:RdbmsReader.java


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