[ rubbish-db ]

ソース

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

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

println(new TabularFormat(dbh.query("SELECT * FROM PUBLISHER ORDER BY ID")));

Publisher publisher = Publisher.find(Publisher.ID.eq("01"));
publisher.setName("○○○○○");
publisher.save();

println(new TabularFormat(dbh.query("SELECT * FROM PUBLISHER ORDER BY ID")));

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

結果

connect database 'url=jdbc:hsqldb:hsql://localhost, user=sa, password='.
'SELECT * FROM PUBLISHER ORDER BY ID'
+--+--------------------+-------+-----------------------+-----------------------+
|ID|NAME                |VOLUMES|UPDATE_DATE            |CREATE_DATE            |
+--+--------------------+-------+-----------------------+-----------------------+
|00|ミュンヒハウゼン出版|1      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|01|栄学館              |4      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|02|時源出版            |4      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|03|曙蓬莱新聞社        |4      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|04|太公望書林          |12     |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|05|日本曙蓬莱武術協会  |5      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|06|民明書房            |76     |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
+--+--------------------+-------+-----------------------+-----------------------+
'SELECT * FROM PUBLISHER WHERE ID = ? [01]'
'UPDATE PUBLISHER SET NAME = ?  WHERE VOLUMES = ? AND UPDATE_DATE = ? AND NAME = ? AND CREATE_DATE = ? AND ID = ? [○○○○○, 4, 2005-07-10 17:10:00.000, 栄学館, 1999-07-10 17:10:00.000, 01]'
'SELECT * FROM PUBLISHER ORDER BY ID'
+--+--------------------+-------+-----------------------+-----------------------+
|ID|NAME                |VOLUMES|UPDATE_DATE            |CREATE_DATE            |
+--+--------------------+-------+-----------------------+-----------------------+
|00|ミュンヒハウゼン出版|1      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|01|○○○○○          |4      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|02|時源出版            |4      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|03|曙蓬莱新聞社        |4      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|04|太公望書林          |12     |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|05|日本曙蓬莱武術協会  |5      |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
|06|民明書房            |76     |2005-07-10 17:10:00.000|1999-07-10 17:10:00.000|
+--+--------------------+-------+-----------------------+-----------------------+
rollback transaction.
disconnect database.