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


Java ResultRowMap类代码示例

本文整理汇总了Java中de.fuberlin.wiwiss.d2rq.sql.ResultRowMap的典型用法代码示例。如果您正苦于以下问题:Java ResultRowMap类的具体用法?Java ResultRowMap怎么用?Java ResultRowMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: row

import de.fuberlin.wiwiss.d2rq.sql.ResultRowMap; //导入依赖的package包/类
private ResultRow row(String spec) {
	String[] parts = spec.split("\\|", -1);
	Attribute[] columns = {col1, col2, col3, col4, col5};
	Map<ProjectionSpec,String> result = new HashMap<ProjectionSpec,String>();
	for (int i = 0; i < parts.length && i < columns.length; i++) {
		result.put(columns[i], parts[i]);
	}
	return new ResultRowMap(result);
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:10,代码来源:PatternTest.java

示例2: execute

import de.fuberlin.wiwiss.d2rq.sql.ResultRowMap; //导入依赖的package包/类
private void execute() {
	MutableRelation newRelation = new MutableRelation(downloadMap.getRelation());
	NodeMaker x = downloadMap.nodeMaker().selectNode(Node.createURI(uri), newRelation);
	// URI didn't fit the node maker
	if (x.equals(NodeMaker.EMPTY)) return;
	Set<ProjectionSpec> requiredProjections = new HashSet<ProjectionSpec>();
	requiredProjections.add(downloadMap.getContentDownloadColumn());
	requiredProjections.addAll(mediaTypeValueMaker.projectionSpecs());
	newRelation.project(requiredProjections);
	newRelation.limit(1);
	Relation filteredRelation = newRelation.immutableSnapshot();
	SelectStatementBuilder builder = new SelectStatementBuilder(filteredRelation);
	String sql = builder.getSQLStatement();
	int contentColumn = builder.getColumnSpecs().indexOf(downloadMap.getContentDownloadColumn()) + 1;
   	ConnectedDB db = filteredRelation.database();
	Connection conn = db.connection();
	try {
		statement = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
		log.debug(sql);
		resultSet = statement.executeQuery(sql);
		if (!resultSet.next()) {
			close();
			return;	// 0 results
		}
		int type = resultSet.getMetaData().getColumnType(contentColumn);
		// TODO Handle Oracle BFILE type; there's some code for that already in ResultRowMap
		if (type == Types.BINARY || type == Types.VARBINARY || type == Types.LONGVARBINARY || type == Types.BLOB) {
			resultStream = resultSet.getBinaryStream(contentColumn);
			if (resultSet.wasNull()) {
				resultStream = null;
			}
		} else {
			String s = resultSet.getString(contentColumn);
			if (!resultSet.wasNull()) {
				resultStream = new ByteArrayInputStream(s.getBytes());
			}
		}
		mediaType = mediaTypeValueMaker.makeValue(
				ResultRowMap.fromResultSet(resultSet, builder.getColumnSpecs(), db));
	} catch (SQLException ex) {
		throw new D2RQException(ex);
	}
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:44,代码来源:DownloadContentQuery.java


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