[ rubbish-db ]

ソース

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

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

println(new TabularFormat(dbh.query("SELECT * FROM BOOK WHERE PUBLISHER = ? ORDER BY ID", "01")));

Book.update(Book.PUBLISHER.eq("01").and(Book.ID.gt("001")), new MapHandler() {
    public void handle(Map row) {
        row.put(Book.TITLE, "×××××");
    }
});

println(new TabularFormat(dbh.query("SELECT * FROM BOOK WHERE PUBLISHER = ? ORDER BY ID", "01")));

dbh.rollback();
dbh.disconnect();

結果

connect database 'url=jdbc:hsqldb:hsql://localhost, user=sa, password='.
'SELECT * FROM BOOK WHERE PUBLISHER = ? ORDER BY ID [01]'
+---------+---+--------------------------+------+----------+-----------------------+-----------------------+
|PUBLISHER|ID |TITLE                     |AUTHOR|ISSUE_DATE|UPDATE_DATE            |CREATE_DATE            |
+---------+---+--------------------------+------+----------+-----------------------+-----------------------+
|01       |000|インド母なる大地を往く    |      |          |2005-06-10 17:10:00.000|1999-06-10 17:10:00.000|
|01       |001|騎馬民族の逆襲            |      |          |2005-06-10 17:10:00.000|1999-06-10 17:10:00.000|
|01       |002|中国武闘三千年            |      |          |2005-06-10 17:10:00.000|1999-06-10 17:10:00.000|
|01       |003|武家社会に於ける風俗・迷信|      |          |2005-06-10 17:10:00.000|1999-06-10 17:10:00.000|
+---------+---+--------------------------+------+----------+-----------------------+-----------------------+
'UPDATE BOOK SET TITLE = ? WHERE PUBLISHER = ? AND ID > ? [×××××, 01, 001]'
'SELECT * FROM BOOK WHERE PUBLISHER = ? ORDER BY ID [01]'
+---------+---+----------------------+------+----------+-----------------------+-----------------------+
|PUBLISHER|ID |TITLE                 |AUTHOR|ISSUE_DATE|UPDATE_DATE            |CREATE_DATE            |
+---------+---+----------------------+------+----------+-----------------------+-----------------------+
|01       |000|インド母なる大地を往く|      |          |2005-06-10 17:10:00.000|1999-06-10 17:10:00.000|
|01       |001|騎馬民族の逆襲        |      |          |2005-06-10 17:10:00.000|1999-06-10 17:10:00.000|
|01       |002|×××××            |      |          |2005-06-10 17:10:00.000|1999-06-10 17:10:00.000|
|01       |003|×××××            |      |          |2005-06-10 17:10:00.000|1999-06-10 17:10:00.000|
+---------+---+----------------------+------+----------+-----------------------+-----------------------+
rollback transaction.
disconnect database.