本文整理汇总了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);
}
示例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);
}
}