[ 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 book = Book.find(Book.PUBLISHER.eq("01").and(Book.ID.eq("001"));
println(book);
book.destroy();

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|
+---------+---+--------------------------+------+----------+-----------------------+-----------------------+
'SELECT * FROM BOOK WHERE PUBLISHER = ? AND ID = ? [01, 001]'
Book@{author=null, create_date=1999-06-10 17:10:00.000, id=001, issue_date=null, publisher=01, title=騎馬民族の逆襲, update_date=2005-06-10 17:10:00.000}
'DELETE FROM BOOK  WHERE ISSUE_DATE IS NULL AND UPDATE_DATE = ? AND TITLE = ? AND PUBLISHER = ? AND CREATE_DATE = ? AND AUTHOR IS NULL AND ID = ? [2005-06-10 17:10:00.000, 騎馬民族の逆襲, 01, 1999-06-10 17:10:00.000, 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       |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.