[#890] Add Factory.selectCount() convenience method
This commit is contained in:
parent
84e1eab570
commit
a8aa1fe48e
@ -2176,6 +2176,12 @@ public abstract class jOOQAbstractTest<
|
||||
assertEquals("test", result.get(0).getValue(f3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectCountQuery() throws Exception {
|
||||
assertEquals(4, create().selectCount().from(TBook()).fetchOne(0));
|
||||
assertEquals(2, create().selectCount().from(TAuthor()).fetchOne(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectQuery() throws Exception {
|
||||
SelectQuery q = create().selectQuery();
|
||||
|
||||
@ -1028,6 +1028,26 @@ public class Factory implements Configuration {
|
||||
return new SelectImpl(this).select(one());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL select statement for <code>COUNT(*)</code>
|
||||
* <p>
|
||||
* Example: <code><pre>
|
||||
* Factory create = new Factory();
|
||||
*
|
||||
* create.selectCount()
|
||||
* .from(table1)
|
||||
* .join(table2).on(field1.equal(field2))
|
||||
* .where(field1.greaterThan(100))
|
||||
* .orderBy(field2)
|
||||
* .execute();
|
||||
* </pre></code>
|
||||
*
|
||||
* @see #one()
|
||||
*/
|
||||
public final SelectSelectStep selectCount() {
|
||||
return new SelectImpl(this).select(count());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new DSL select statement.
|
||||
* <p>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user