當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。