提交 e9df482d authored 作者: Thomas Mueller's avatar Thomas Mueller

The Shell tool can now enable, disable, and display the current autocommit mode.

上级 8bbd491c
...@@ -164,6 +164,7 @@ public class Shell extends Tool implements Runnable { ...@@ -164,6 +164,7 @@ public class Shell extends Tool implements Runnable {
println("maxwidth Set maximum column width (default is 100)"); println("maxwidth Set maximum column width (default is 100)");
println("show List all tables"); println("show List all tables");
println("describe Describe a table"); println("describe Describe a table");
println("autocommit Enable or disable autocommit");
println("history Show the last 20 statements"); println("history Show the last 20 statements");
println("quit or exit Close the connection and exit"); println("quit or exit Close the connection and exit");
println(""); println("");
...@@ -276,6 +277,16 @@ public class Shell extends Tool implements Runnable { ...@@ -276,6 +277,16 @@ public class Shell extends Tool implements Runnable {
} finally { } finally {
JdbcUtils.closeSilently(rs); JdbcUtils.closeSilently(rs);
} }
} else if (upper.startsWith("AUTOCOMMIT")) {
upper = upper.substring("AUTOCOMMIT".length()).trim();
if ("TRUE".equals(upper)) {
conn.setAutoCommit(true);
} else if ("FALSE".equals(upper)) {
conn.setAutoCommit(false);
} else {
println("Usage: autocommit [true|false]");
}
println("Autocommit is now " + conn.getAutoCommit());
} else if (upper.startsWith("MAXWIDTH")) { } else if (upper.startsWith("MAXWIDTH")) {
upper = upper.substring("MAXWIDTH".length()).trim(); upper = upper.substring("MAXWIDTH".length()).trim();
try { try {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论