[ rubbish-db ]

ソース

RubbishDatabase dbh = new RubbishDatabase();
dbh.setLogging(true);

dbh.connect("jdbc:hsqldb:hsql://localhost", "sa", "");

int pcnt = dbh.count(Publisher.class);
println("PUBLISHER: " + pcnt + "件");

int bcnt = dbh.count(Book.class, "PUBLISHER=?", "06");
println("BOOK(民明書房): " + bcnt + "件");

dbh.disconnect();

結果

#####################################################################
## sample_count
connect database 'url=jdbc:hsqldb:hsql://localhost, user=sa, password='.
'SELECT COUNT(*) FROM PUBLISHER'
PUBLISHER: 7件
'SELECT COUNT(*) FROM BOOK WHERE PUBLISHER=? [06]'
BOOK(民明書房): 76件
disconnect database.