本文整理了Java中org.skife.jdbi.v2.Query.setMaxRows
方法的一些代码示例,展示了Query.setMaxRows
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setMaxRows
方法的具体详情如下:
包路径:org.skife.jdbi.v2.Query
类名称:Query
方法名:setMaxRows
[英]Specify the maimum number of rows the query is to return. This uses the underlying JDBC Statement#setMaxRows(int)}.
[中]指定查询要返回的最大行数。它使用底层JDBC语句#setMaxRows(int)}。
代码示例来源:origin: apache/incubator-druid
@Override
public List<AuditEntry> withHandle(Handle handle)
{
Query<Map<String, Object>> query = handle.createQuery(theQueryString);
if (key != null) {
query.bind("audit_key", key);
}
return query.bind("type", type)
.setMaxRows(theLimit)
.map(
new ResultSetMapper<AuditEntry>()
{
@Override
public AuditEntry map(int index, ResultSet r, StatementContext ctx)
throws SQLException
{
try {
return jsonMapper.readValue(r.getBytes("payload"), AuditEntry.class);
}
catch (IOException e) {
throw new SQLException(e);
}
}
}
)
.list();
}
}
代码示例来源:origin: org.kill-bill.commons/killbill-jdbi
@Override
public void apply(SQLStatement q) throws SQLException
{
assert q instanceof Query;
((Query)q).setMaxRows(va);
}
};
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
public void apply(SQLStatement q) throws SQLException
{
assert q instanceof Query;
((Query)q).setMaxRows(va);
}
};
代码示例来源:origin: org.kill-bill.commons/killbill-jdbi
@Override
public void apply(SQLStatement q) throws SQLException
{
assert q instanceof Query;
((Query)q).setMaxRows(va);
}
};
代码示例来源:origin: org.kill-bill.commons/killbill-jdbi
@Override
public void apply(SQLStatement q) throws SQLException
{
assert q instanceof Query;
((Query)q).setMaxRows(va);
}
};
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
public void apply(SQLStatement q) throws SQLException
{
assert q instanceof Query;
((Query)q).setMaxRows(va);
}
};
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
public void apply(SQLStatement q) throws SQLException
{
assert q instanceof Query;
((Query)q).setMaxRows(va);
}
};
代码示例来源:origin: com.nesscomputing.migratory/migratory-core
public static int getInteger(final Handle handle, final String query)
{
return handle.createQuery(query)
.map(IntegerMapper.FIRST)
// Work around an *incredibly* obscure bug in hsqldb 1.8.0.x where setMaxRows(1)
// (which first does) will only return 0 (no rows) or 1 (rows) for COUNT(*)
.setMaxRows(0)
.first();
}
}
代码示例来源:origin: org.apache.druid/druid-server
@Override
public List<AuditEntry> withHandle(Handle handle)
{
Query<Map<String, Object>> query = handle.createQuery(theQueryString);
if (key != null) {
query.bind("audit_key", key);
}
return query.bind("type", type)
.setMaxRows(theLimit)
.map(
new ResultSetMapper<AuditEntry>()
{
@Override
public AuditEntry map(int index, ResultSet r, StatementContext ctx)
throws SQLException
{
try {
return jsonMapper.readValue(r.getBytes("payload"), AuditEntry.class);
}
catch (IOException e) {
throw new SQLException(e);
}
}
}
)
.list();
}
}
代码示例来源:origin: io.druid/druid-server
@Override
public List<AuditEntry> withHandle(Handle handle) throws Exception
{
Query<Map<String, Object>> query = handle.createQuery(theQueryString);
if (key != null) {
query.bind("audit_key", key);
}
return query.bind("type", type)
.setMaxRows(theLimit)
.map(
new ResultSetMapper<AuditEntry>()
{
@Override
public AuditEntry map(int index, ResultSet r, StatementContext ctx)
throws SQLException
{
try {
return jsonMapper.readValue(r.getBytes("payload"), AuditEntry.class);
}
catch (IOException e) {
throw new SQLException(e);
}
}
}
)
.list();
}
}
代码示例来源:origin: org.jdbi/jdbi
@Test
public void testStatementCustomizersPersistAfterMap() throws Exception
{
h.insert("insert into something (id, name) values (?, ?)", 1, "hello");
h.insert("insert into something (id, name) values (?, ?)", 2, "world");
List<Something> rs = h.createQuery("select id, name from something")
.setMaxRows(1)
.map(Something.class)
.list();
assertEquals(1, rs.size());
}
代码示例来源:origin: org.kill-bill.commons/killbill-jdbi
@Test
public void testStatementCustomizersPersistAfterMap() throws Exception
{
h.insert("insert into something (id, name) values (?, ?)", 1, "hello");
h.insert("insert into something (id, name) values (?, ?)", 2, "world");
List<Something> rs = h.createQuery("select id, name from something")
.setMaxRows(1)
.map(Something.class)
.list();
assertEquals(1, rs.size());
}
内容来源于网络,如有侵权,请联系作者删除!